Need to set Global variable
I am using xslt1.0.I want to use a global variable such a way that, th开发者_运维技巧e value of variable is set from one template and used in another template..How can i achieve this. Please help me..Thanks in advance..
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:variable name="vTest">
<xsl:apply-templates select="/*/element"/>
</xsl:variable>
<xsl:template match="/">
<xsl:value-of select="$vTest"/>
</xsl:template>
</xsl:stylesheet>
XML input:
<t>
<element>A</element>
<element>B</element>
<element>C</element>
</t>
Result:
ABC
Note: $vTest with a value template will be RTF in 1.0. But for this case it can be used like as of string data-type.
精彩评论