XSLT generate-id() º¯Êý

¶¨ÒåºÍÓ÷¨

generate-id() º¯Êý·µ»ØÎ¨Ò»±êʶָ¶¨½ÚµãµÄ×Ö·û´®Öµ¡£

Èç¹ûÖ¸¶¨µÄ½Úµã¼¯Êǿյģ¬Ôò·µ»Ø¿Õ×Ö·û´®¡£Èç¹ûÊ¡ÂÔÁË node-set ²ÎÊý£¬ÔòĬÈÏÉèÖÃΪµ±Ç°½Úµã¡£

Óï·¨

string generate-id(node-set?)

²ÎÊý

²ÎÊý ÃèÊö
node-set ¿ÉÑ¡¡£¹æ¶¨Éú³ÉÄĸö½Úµã¼¯µÄΨһ id¡£

Àý×Ó

<?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>
<h3>Artists:</h3>
<ul>
<xsl:for-each select="catalog/cd">
<li>
<a href="#{generate-id(artist)}">
<xsl:value-of select="artist" /></a>
</li>
</xsl:for-each>
</ul>
<hr />
<xsl:for-each select="catalog/cd">
Artist: <a name="{generate-id(artist)}">
<xsl:value-of select="artist" /></a>
<br />
Title: <xsl:value-of select="title" />
<br />
Price: <xsl:value-of select="price" />
<hr />
</xsl:for-each>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

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

VUE