Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Modes (7/7) >

Mode "#current" in shared modes

Mode "#current" is useful when it is used in a shared template. It sets the value of xsl:apply-templates to the mode in which the ancestor xsl:template was called.

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  mode="m1"/>
                  <xsl:apply-templates  mode="m2"/>
                  <xsl:apply-templates  mode="m3"/>
                  <xsl:apply-templates  mode="m4"/>
            </xsl:template>

            <xsl:template  match="bbb"
                        mode="m1 m3 m4">
                  <bbb-1-3-4>
                        <xsl:apply-templates  select="ccc"
                                    mode="#current"/>
                  </bbb-1-3-4>
            </xsl:template>

            <xsl:template  match="bbb"
                        mode="m2">
                  <bbb-2>
                        <xsl:apply-templates  select="ccc"
                                    mode="#current"/>
                  </bbb-2>
            </xsl:template>

            <xsl:template  match="ccc"
                        mode="m1">
                  <ccc-1/>
            </xsl:template>

            <xsl:template  match="ccc"
                        mode="m2">
                  <ccc-2/>
            </xsl:template>

            <xsl:template  match="ccc"
                        mode="m3">
                  <ccc-3/>
            </xsl:template>

            <xsl:template  match="ccc"
                        mode="m4">
                  <ccc-4/>
            </xsl:template>

      </xsl:stylesheet>
XML

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

      <bbb-1-3-4>
            <ccc-1/>
      </bbb-1-3-4>
      <bbb-2>
            <ccc-2/>
      </bbb-2>
      <bbb-1-3-4>
            <ccc-3/>
      </bbb-1-3-4>
      <bbb-1-3-4>
            <ccc-4/>
      </bbb-1-3-4>


Previous chapter: Value-of
Next chapter: Context
Previous page: Mode: #current
Next page: - - -

Kevin Carr in Stanton

Natural Skin Care and European Soaps
Kevin Carr
Mayor Dave Shawver 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