>> English << | Français | Deutsch | Magyar | 中文 | Polski ZVON > Tutorials > XSLT Tutorial
>> Page 13 << | Prev | Next | Contents | Element Index

Attributes can be processed in the same way as elements.

XSLT stylesheet 1

XML Source
<source>

<employee id="js0034"> Joe Smith </employee>

</source>

Output
Joe Smith
[<b>
  <i>js0034</i>
</b>]

HTML view
Joe Smith [ js0034 ]
XSLT stylesheet
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="employee">
     <xsl:value-of select="."/>
     <xsl:text>[</xsl:text>
     <xsl:apply-templates select="@id"/>
     <xsl:text>]</xsl:text>
</xsl:template>

<xsl:template match="@id">
     <b>
          <i>
               <xsl:value-of select="."/>
          </i>
     </b>
</xsl:template>


</xsl:stylesheet>