How to pass variables between two templates in XSLT

FirefoxUK

New Member
How to pass variables between two templates in XSLT.I cannot use global variable because value of variable is dependent on current node under evaluation.Say I have XSLT of sort:\[code\]<xsl:template match="product"><xsl:variable name="pr-pos" select="count(./preceding-sibling::product)+1"/>......<xsl:apply-templates select="countries/country"/></xsl:template><xsl:template match="countries/country"><tr id="country-id"> <td><a href="http://stackoverflow.com/questions/11277184/#" class="action" id="{concat('a-',$pr-pos)}">+</a></td>....\[/code\]This gives error as $pr-pos is not accessible in second template.How do I pass variable pr-pos' value to other template? How can I do this?
 
Back
Top