E
El Durango
I don't know if this is the right area for this post but I have a stylesheet
that I use to render XML to another format. At the moment I need to have a
variable set to a particular XPath based on a certain test case derived from
the XML file.
So I would have something like
<xsl:template name="A">
<xsl:choose>
<xsl:when test="(insert logic expression)">
<xsl:variable name="myVar" select="(insert Xpath expression)"/>
</xsl:when>
<xsltherwise>
<xsl:variable name="myVar" select="(insert other Xpath
expression)"/>
</xsltherwise>
</xsl:choose>
</xsl:template>
Now this is just pseudocode I put up but the problem I have is that the
variable will be out of scope and if I do declare it above the <xsl:choose>
statement it will not work either, I assume since XSL variable cannot be
reassigned.
Anyway I am an XSL newbie as you can tell any proper way of setting a
variable based on a conditional statement?
Thank you for your replies.
that I use to render XML to another format. At the moment I need to have a
variable set to a particular XPath based on a certain test case derived from
the XML file.
So I would have something like
<xsl:template name="A">
<xsl:choose>
<xsl:when test="(insert logic expression)">
<xsl:variable name="myVar" select="(insert Xpath expression)"/>
</xsl:when>
<xsltherwise>
<xsl:variable name="myVar" select="(insert other Xpath
expression)"/>
</xsltherwise>
</xsl:choose>
</xsl:template>
Now this is just pseudocode I put up but the problem I have is that the
variable will be out of scope and if I do declare it above the <xsl:choose>
statement it will not work either, I assume since XSL variable cannot be
reassigned.
Anyway I am an XSL newbie as you can tell any proper way of setting a
variable based on a conditional statement?
Thank you for your replies.