Mega Code Archive

 
Categories / XML / XSLT StyleSheet
 

Use-attribute-sets

File: Data.xml <?xml version="1.0"?> <?xml-stylesheet href="Transform.xslt" type="text/xsl"?> <message>Message.</message> File: Transform.xslt <xsl:stylesheet version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">   <xsl:output method="xml" indent="yes" />   <xsl:attribute-set name="para" use-attribute-sets="paragraph" />   <xsl:attribute-set name="paragraph">     <xsl:attribute name="priority">medium</xsl:attribute>     <xsl:attribute name="date">2003-09-23</xsl:attribute>     <xsl:attribute name="doc:style" namespace="http://www.rntsoft.com/documents">classic</xsl:attribute>   </xsl:attribute-set>   <xsl:template match="/">     <xsl:element name="paragraph" use-attribute-sets="para">       <xsl:apply-templates />     </xsl:element>   </xsl:template> </xsl:stylesheet> Output: <?xml version="1.0" encoding="UTF-8"?> <paragraph xmlns:doc="http://www.rntsoft.com/documents" priority="medium" date="2003-09-23"            doc:style="classic">Message.</paragraph>