xml - assign mutiple variable in for-each loop -
i want set multiple variable value in loop using xslt. xml example is,
<details> <person> <name>abcd</name> <age>24</age> </person> <person> <age>27</age> <name>xyz</name> </person>
i want store name , age in 2 different variable e.g
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="details"> <xsl:variable name="name"/> <xsl:variable name="age"/> <xsl:for-each select="./person"> // want store name , age in 2 different variable later use after for-each loop </xsl:for-each> </xsl:template> </xsl:stylesheet>
it's example xml , xslt. know, how ?
q.: "is know, how ?"
short answer: not possible change value of variable after declaration. not possible access variable declared in "block" (e.g xsl:for-each) outside of "block".
Comments
Post a Comment