English | Français | Deutsch | Magyar | >> 中文 << | Polski adultinternetusers > Tutorials > XSLT Tutorial
>> 页 19 << | 上一条 | 下一条 | 目录 | 元素索引

用 xsl:for-each ( XSLT stylesheet 1XSLT stylesheet 2 ) 或者 xsl:apply-templates ( XSLT stylesheet 3 ) 选出的节点可以被排序。次序决定于排序属性。 XSLT stylesheet 1 是升序,而 XSLT stylesheet 2 是降序排列。

XSLT stylesheet 1

XML源码
<source>

<name>John</name>
<name>Josua</name>
<name>Charles</name>
<name>Alice</name>
<name>Martha</name>
<name>George</name>

</source>

输出
<TABLE>
  <TR>
     <TH>Alice</TH>
  </TR>
  <TR>
     <TH>Charles</TH>
  </TR>
  <TR>
     <TH>George</TH>
  </TR>
  <TR>
     <TH>John</TH>
  </TR>
  <TR>
     <TH>Josua</TH>
  </TR>
  <TR>
     <TH>Martha</TH>
  </TR>
</TABLE>

用HTML察看
Alice
Charles
George
John
Josua
Martha
XSLT stylesheet
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="/">
     <TABLE>
          <xsl:for-each select="//name">
               <xsl:sort order="ascending" select="."/>
               <TR>
                    <TH>
                         <xsl:value-of select="."/>
                    </TH>
               </TR>
          </xsl:for-each>
     </TABLE>
</xsl:template>


</xsl:stylesheet>



XSLT stylesheet 2

XML源码
<source>

<name>John</name>
<name>Josua</name>
<name>Charles</name>
<name>Alice</name>
<name>Martha</name>
<name>George</name>

</source>

输出
<TABLE>
  <TR>
     <TH>Martha</TH>
  </TR>
  <TR>
     <TH>Josua</TH>
  </TR>
  <TR>
     <TH>John</TH>
  </TR>
  <TR>
     <TH>George</TH>
  </TR>
  <TR>
     <TH>Charles</TH>
  </TR>
  <TR>
     <TH>Alice</TH>
  </TR>
</TABLE>

用HTML察看
Martha
Josua
John
George
Charles
Alice
XSLT stylesheet
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="/">
     <TABLE>
          <xsl:for-each select="//name">
               <xsl:sort order="descending" select="."/>
               <TR>
                    <TH>
                         <xsl:value-of select="."/>
                    </TH>
               </TR>
          </xsl:for-each>
     </TABLE>
</xsl:template>


</xsl:stylesheet>



XSLT stylesheet 3

XML源码
<source>

<name>John</name>
<name>Josua</name>
<name>Charles</name>
<name>Alice</name>
<name>Martha</name>
<name>George</name>

</source>

输出
<TABLE>
  <TR>
     <TH>Martha</TH>
  </TR>
  <TR>
     <TH>Josua</TH>
  </TR>
  <TR>
     <TH>John</TH>
  </TR>
  <TR>
     <TH>George</TH>
  </TR>
  <TR>
     <TH>Charles</TH>
  </TR>
  <TR>
     <TH>Alice</TH>
  </TR>
</TABLE>

用HTML察看
Martha
Josua
John
George
Charles
Alice
XSLT stylesheet
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="/">
     <TABLE>
          <xsl:apply-templates select="//name">
               <xsl:sort order="descending" select="."/>
          </xsl:apply-templates>
     </TABLE>
</xsl:template>

<xsl:template match="name">
     <TR>
          <TH>
               <xsl:value-of select="."/>
          </TH>
     </TR>
</xsl:template>


</xsl:stylesheet>


Kevin Carr in Stanton

Natural Skin Care and European Soaps
Kevin Carr
Mayor Dave Shawver Stanton
Internetusers
This is the website that has all the latest for surf, skate and snow. You can also see it here:. You'll be glad you saw the surf apparel.

Take a moment to visit 1cecilia448 or see them on twitter at 1cecilia448 or view them on facebook at 1cecilia448.

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