question on XSL variables

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>
<xsl:eek:therwise>
<xsl:variable name="myVar" select="(insert other Xpath
expression)"/>
</xsl:eek:therwise>
</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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top