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

Tunneling of parameters

If xsl:with-param instruction is used inside xsl:apply-templates the parameter value is passed to a matching template. If we call another template from the matching one, the value of the parameter is not passed.

Sometime it is useful to have this parameter available to further templates as well. In this case xsl:with-param bears the attribute tunnel with value "yes". If the target template uses xsl:param with the tunnel attribute set to "yes", tunneling of parameters is accomplished.

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">
                  <xsl:apply-templates  select="bbb">
                        <xsl:with-param  name="parA"
                                    select="1"
                                    tunnel="no"/>
                        <xsl:with-param  name="parB"
                                    select="9"
                                    tunnel="yes"/>
                  </xsl:apply-templates>
            </xsl:template>

            <xsl:template  match="bbb">
                  <xsl:param  name="parA"/>
                  <xsl:param  name="parB"/>
                  <bbb-final>
                        <xsl:text>[</xsl:text>
                        <xsl:value-of  select="$parA"/>
                        <xsl:text> - </xsl:text>
                        <xsl:value-of  select="$parB"/>
                        <xsl:text>]</xsl:text>
                  </bbb-final>
                  <xsl:apply-templates  select="ccc"/>
            </xsl:template>

            <xsl:template  match="ccc">
                  <xsl:param  name="parA"
                              tunnel="yes"/>
                  <xsl:param  name="parB"
                              tunnel="yes"/>
                  <ccc-final>
                        <xsl:text>[</xsl:text>
                        <xsl:value-of  select="$parA"/>
                        <xsl:text> - </xsl:text>
                        <xsl:value-of  select="$parB"/>
                        <xsl:text>]</xsl:text>
                  </ccc-final>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa>
            <bbb>
                  <ccc/>
            </bbb>
      </aaa>
Output

      <bbb-final>[1 - ]</bbb-final>
      <ccc-final>[ - 9]</ccc-final>


Previous chapter: Named-Templates
Next chapter: Stylesheet Functions
Previous page: Difference between parameters and variables
Next page: - - -

Kevin Carr

Natural Skin Care European Soaps
Scented Body Care Shea Body Butter
city of stanton
search engine optimization orange county internetusers


Also, you will want to check out Stanton California so you can see what's up and they are part of Stanton City Hall as well.

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

This is the guy we need in government office. His name is Kevin Carr City Of Stanton Council Candidate and he is a great guy. and we can get surf t shirts surfing shirt and And you must check out this website swim suit swimming suit and swim trunks