Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Implicit behaviour (8/10) >

Implicit passing of parameters

Implicit templates automatically pass parameters which they receive from the calling template with their xsl:apply-templatesCall.

There is no explicit template between bbb and ddd element in the first case and so the parameter is passed to the ddd template. In the second case there is an intervening eee template which does not pass parameters with its xsl:apply-templatesCall and so the second DDD is empty.

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:template  match="/aaa">
                  <xxx>
                        <xsl:apply-templates  select="bbb">
                              <xsl:with-param  name="par"
                                          select="8"/>
                        </xsl:apply-templates>
                  </xxx>
            </xsl:template>

            <xsl:template  match="ddd">
                  <xsl:param  name="par"/>
                  <DDD>
                        <xsl:value-of  select="$par"/>
                  </DDD>
            </xsl:template>

            <xsl:template  match="eee">
                  <EEE>
                        <xsl:apply-templates/>
                  </EEE>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa>
            <bbb>
                  <ccc>
                        <ddd/>
                  </ccc>
            </bbb>
            <bbb>
                  <eee>
                        <ddd/>
                  </eee>
            </bbb>
      </aaa>
Output

      <xxx>
            <DDD>8</DDD>
            <EEE>
                  <DDD/>
            </EEE>
      </xxx>


Previous chapter: Context
Next chapter: Arithmetics
Previous page: Implicit templates for text nodes
Next page: Priorities of implicit templates

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