Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Sequences (10/10) >

Instruction xsl:sequence

Behavior of the instruction xsl:sequence is very similar to xsl:copy-of. The difference, which is mostly hidden from the user is that xsl:sequence may return existing nodes and so makes transformation more straightforward and therefore efficient.
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">
                  <aaa>
                        <v1>
                              <i>
                                    <xsl:sequence  select="bbb/@x"/>
                              </i>
                              <ii>
                                    <xsl:sequence  select="bbb"/>
                              </ii>
                              <iii>
                                    <xsl:sequence  select="1 to 4"/>
                              </iii>
                        </v1>
                        <v2>
                              <i>
                                    <xsl:copy-of  select="bbb/@x"/>
                              </i>
                              <ii>
                                    <xsl:copy-of  select="bbb"/>
                              </ii>
                              <iii>
                                    <xsl:copy-of  select="1 to 4"/>
                              </iii>
                        </v2>
                        <v3>
                              <i>
                                    <xsl:value-of  select="bbb/@x"/>
                              </i>
                              <ii>
                                    <xsl:value-of  select="bbb"/>
                              </ii>
                              <iii>
                                    <xsl:copy-of  select="1 to 4"/>
                              </iii>
                        </v3>
                  </aaa>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa>
            <bbb  x="1">A</bbb>
            <bbb  x="2">B</bbb>
      </aaa>
Output

      <aaa>
            <v1>
                  <i  x="2"/>
                  <ii>
                        <bbb  x="1">A</bbb>
                        <bbb  x="2">B</bbb>
                  </ii>
                  <iii>1 2 3 4</iii>
            </v1>
            <v2>
                  <i  x="2"/>
                  <ii>
                        <bbb  x="1">A</bbb>
                        <bbb  x="2">B</bbb>
                  </ii>
                  <iii>1 2 3 4</iii>
            </v2>
            <v3>
                  <i>1 2</i>
                  <ii>A B</ii>
                  <iii>1 2 3 4</iii>
            </v3>
      </aaa>


Previous chapter: Templates - basic usage
Next chapter: Sequence Combinations
Previous page: Several variables can be used is for... in... return instruction
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