Referring to the Current Node : current « XPath « XML Tutorial






File: Data.xml

 
<?xml version="1.0"?>
<employees>
  <animal>
    <name language="English">T1</name>
    <name language="Latin">T2</name>
    <projects>
      <project>project1</project>
    </projects>
  </animal>
</employees>

File: Transform.xslt

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">
  <xsl:template match="animal">
    <xsl:apply-templates select="name" />
  </xsl:template>
  <xsl:template match="name[@language='English']">
    <nobr>
      <b>
        <xsl:value-of select="." />
        :
      </b>
    </nobr>
  </xsl:template>
</xsl:stylesheet>

Output:

<?xml version="1.0" encoding="UTF-8"?>
  <nobr><b>T1
        :
      </b></nobr>T2








4.3.current
4.3.1.current name
4.3.2.Sort by current value
4.3.3.current() returns a node-set that has the current node as its only member
4.3.4.get current node with current() function
4.3.5.current() and name()
4.3.6.Referring to the Current Node