question on XSL variables

Discussion in 'XML' started by El Durango, Nov 2, 2005.

  1. El Durango

    El Durango Guest

    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.
     
    El Durango, Nov 2, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Flood
    Replies:
    0
    Views:
    1,023
    Kevin Flood
    Sep 8, 2004
  2. Kevin Flood
    Replies:
    1
    Views:
    2,741
    Kevin Flood
    Sep 13, 2004
  3. Vijay singh
    Replies:
    1
    Views:
    436
    Martin Honnen
    Nov 4, 2004
  4. Replies:
    1
    Views:
    3,613
    A. Bolmarcich
    May 27, 2005
  5. Replies:
    9
    Views:
    959
Loading...

Share This Page