Share on Google+Share on Google+

XSLT Elements and Attributes

Advertisement
The element is used to create an output element with the specified name and it specifies that an element is for output. It's name attribute specifies the name of the element. The elements can be nested.

Elements and Attributes

The element is used to create an output element with the specified name and it specifies that an element is for output. It's name attribute specifies the name of the element. The elements can be nested.

For example:

<xsl:element name="elms">
      <xsl:element name="elm">hi</xsl:element>     
</xsl:element>

Like xsl:element element, the xsl:attribute element is used to output an attribute.

<elm>
   <xsl:attribute name="attr">
        <xsl:value-of select="one"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="two"/>
   </xsl:attribute>
   hi
</elm>

You can also use curly brackets instead of using attributes. Using curly brackets is simpler than using attributes and easy to write also.

<elm attr="{one} {two}">hi</elm>


Advertisements

Advertisement

Posted on: November 26, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.