XSLT Elements and Attributes


 

XSLT 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.

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>


Ads