Mega Code Archive

 
Categories / XML Tutorial / XSLT StyleSheet
 

Output xml element with namespace

File: Data.xml <?xml version="1.0"?> <message>You can use literal result elements in stylesheets.</message> File: Transform.xslt <xsl:stylesheet version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   xmlns:doc="http://www.rntsoft.com/documents">   <xsl:output method="xml" indent="yes" />   <xsl:template match="/">     <xsl:element name="doc:paragraph">       <xsl:apply-templates />     </xsl:element>   </xsl:template> </xsl:stylesheet> Output: <?xml version="1.0" encoding="UTF-8"?> <doc:paragraph xmlns:doc="http://www.rntsoft.com/documents">You can use literal result elements in stylesheets.</doc:paragraph>