Loading ...
Sorry, an error occurred while loading the content.

xsl : variable

Expand Messages
  • Ryan Thompson
    hi, is there a way of declaring a variable in xsl with global scope? for eg:
    Message 1 of 2 , Jul 2 4:05 AM
    • 0 Attachment
      hi,

      is there a way of declaring a variable in xsl with global scope?
      for eg:
      <xsl:template match = "root">
      <xsl:variable name = "var" select = "@attribute1"/>
      <xsl:apply-templates select = "node1"/>
      </xsl:template>

      <xsl:template match = "node1">
      Now can I use the variable $attribute1 in this template ?
      </xsl:template>

      Pls. help.

      --
      Ryan Thompson
      _________________________________________________
      IncrediMail - Email has finally evolved - Click Here
    • Murali T N
      To access the variable, it can be passed as shown below
      Message 2 of 2 , Jul 6 2:06 AM
      • 0 Attachment

        To access the variable, it can be passed as shown below

        <xsl:template match = "root">
        <xsl:variable name = "var" select = "@attribute1"/>
        <xsl:apply-templates select = "node1">
        <xsl:with-param name="var1" select="$var"/>
        </xsl:apply-templates>
        </xsl:template>

        <xsl:template match = "node1">
        <xsl:param name="var1"/>
        Now you can get the value using $var1
        </xsl:template>

        Murali.

          Ryan Thompson <ryan.projtr@...> wrote:

        hi,

        is there a way of declaring a variable in xsl with global scope?
        for eg:
        <xsl:template match = "root">
        <xsl:variable name = "var" select = "@attribute1"/>
        <xsl:apply-templates select = "node1"/>
        </xsl:template>

        <xsl:template match = "node1">
        Now can I use the variable $attribute1 in this template ?
        </xsl:template>

        Pls. help.

        --
        Ryan Thompson
        _________________________________________________
        IncrediMail - Email has finally evolved - Click Here


        To Post a message, send it to:   xml-tips@...

        To Unsubscribe, send a blank message to: xml-tips-unsubscribe@...


        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



        Do You Yahoo!?
        New! SBC Yahoo! Dial - 1st Month Free & unlimited access

      Your message has been successfully submitted and would be delivered to recipients shortly.