XSLT generate-id() ఫంక్షన్

నిర్వచనం మరియు ఉపయోగం

generate-id() ఫంక్షన్ పేరుము చేయబడిన నోడ్ ని విలువను తిరిగి ఇవ్వబడుతుంది.

పేరుము చేయబడిన నోడ్ సెట్ ఖాళీ అయితే, ఖాళీ స్ట్రింగ్ తిరిగి ఇవ్వబడుతుంది. node-set పారామితిని స్పష్టంచేయకపోతే, ప్రస్తుత నోడ్ ని పూర్తి చేయబడుతుంది.

సంకేతం

string generate-id(node-set?)

పారామితి

పారామితి వివరణ
node-set ఎంపికలు. ఏ నోడ్ సెట్ని ఉత్పత్తి చేయాలో ప్రత్యేక ఐడి ని నిర్ధారించు.

ఉదాహరణ

<?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 ఫైల్ను చూడండి,ఫలితాలను చూడండి.