XSLT current() º¯Êý

¶¨ÒåºÍÓ÷¨

current() º¯Êý·µ»Ø½ö°üº¬µ±Ç°½ÚµãµÄ½Úµã¼¯¡£Í¨³££¬µ±Ç°½ÚµãÓëÉÏÏÂÎĽڵãÊÇÏàͬµÄ¡£

<xsl:value-of select="current()"/>

µÈÓÚ

<xsl:value-of select="."/>

²»¹ý£¬ÓÐÒ»µã²»Í¬¡£ÈÃÎÒÃÇ¿´Ò»ÏÂÏÂÃæµÄ XPath ±í´ïʽ£º"catalog/cd"¡£±í´ïʽѡÔñÁ˵±Ç°½ÚµãµÄ <catalog> ×ӽڵ㣬ȻºóÑ¡ÔñÁË <catalog> ½ÚµãµÄ <cd> ×ӽڵ㡣ÕâÒâζ×Å£¬ÔÚ¼ÆËãµÄÿһ²½ÉÏ£¬"." ¶¼Óв»Í¬µÄÒâÒå¡£

ÏÂÃæÕâÐУº

<xsl:apply-templates select="//cd[@title=current()/@ref]"/>

½«´¦Àí title ÊôÐÔµÄÖµµÈÓÚµ±Ç°½ÚµãµÄ ref ÊôÐÔµÄÖµµÄËùÓÐ cd ÔªËØ¡£

ÓëÕâ¸ö²»Í¬£º

<xsl:apply-templates select="//cd[@title=./@ref]"/>

Õâ¸ö»á´¦Àí title ÊôÐÔºÍ ref ÊôÐÔ¾ßÓÐÏàֵͬµÄËùÓÐ cd ÔªËØ¡£

Óï·¨

node-set current()

Àý×Ó

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
  <body>
  <xsl:for-each select="catalog/cd/artist">
    Current node: <xsl:value-of select="current()"/>
    <br />
  </xsl:for-each>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>

²é¿´ XML Îļþ£¬²é¿´ XSL Îļþ£¬²é¿´½á¹û¡£

VUE