Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Variables and Parameters (5/14) >

Variable shadowing

Global variable can be shadowed by a local one. It means that if local variable has the same name as a global one, the value of the local one is used.

XSLT

      <xsl:stylesheet
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="2.0">
            <xsl:output  method="xml"
                        indent="yes"
                        omit-xml-declaration="yes"/>
            <xsl:variable  name="xxx">xxx-global</xsl:variable>
            <xsl:variable  name="yyy">yyy-global</xsl:variable>

            <xsl:template  match="/aaa">
                  <xsl:variable  name="xxx">xxx-local</xsl:variable>
                  <xsl:variable  name="zzz">zzz-local</xsl:variable>
                  <i>
                        <xsl:value-of  select="$xxx"/>
                  </i>
                  <ii>
                        <xsl:value-of  select="$yyy"/>
                  </ii>
                  <iii>
                        <xsl:value-of  select="$zzz"/>
                  </iii>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa/>
Output

      <i>xxx-local</i>
      <ii>yyy-global</ii>
      <iii>zzz-local</iii>


Previous chapter: Named-Templates
Next chapter: Stylesheet Functions
Previous page: Problems with scope of variables
Next page: Shadowing local variables

Kevin Carr in Stanton

Natural Skin Care and European Soaps
TickTalk 5
city of stanton
internetusers


You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps

Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here:

Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter

and we can get surf t shirts surfing shirt and And you must check out this website swim suit swimming suit and swim trunks