Hi peeps,
I've got an issue with xsl that i could use some help with. I'm under the impression that using the xsl:variable element might be a way to solve the issue.
i would like my xslt from within a <xsl:for-each> element to parse through some nodes in a xml and to set a xsl:variable element if a condition is satisfied, Such that i could do some other stuff outside the <xsl:for-each> once the for loop is over with.
i was wondering if this would work ?
<xsl:variable name="trial"/> <!--an empty global variable -->
<xsl:for-each select="some nodes here">
<xsl:if test="if some condition is satisfied among any of the nodes">
<!-- does this refer to the global variable "trial" ? -->
<!-- I would like to add content to the global variable ? -->
<xsl:variable name=trial>
<xsl:value-of select="'yes'">
</xsl:variable>
</xsl:if>
</xsl:for-each>
<!-- seems like the global trial is still empty -->
<xsl:if test="$trial='yes'">
...do some stuff ...
</xsl:if>
as i have commented in the xsl the global variable is shadowed while inside the for loop, and is still empty once accessed outside the for loop. Is there a way i could solve this issue ? perhaps using some other xsl element ?
Any help would be appreciated ..
Thanks.
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).