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

可以用一个变量来表示结果树片断。对结果树片段的合法操作是节点集操作的子集。仅当一个操作也能运用于字符串操作时,它才能被用于结果树片段(对串操作的操作可能涉及先将串转化为数字或布尔量)。特别地,/, //, 和 [] 操作不能用于结果树片段。当对一个结果树片段进行合法的操作时,它的行为和对节点集的操作是完全一样的。请比较 XSLT stylesheet 1XSLT stylesheet 2

XSLT stylesheet 1

XML源码
<source>

<TABLE border="1">
     <TR>
          <TD>AAA</TD>
          <TD>BBB</TD>
     </TR>
     <TR>
          <TD>aaa</TD>
          <TD>bbb</TD>
     </TR>
</TABLE>
<TABLE border="1">
     <TR>
          <TD>1111111</TD>
     </TR>
     <TR>
          <TD>22222222</TD>
     </TR>
</TABLE>

</source>

输出
<TABLE border="1">

  <TR>

     <TD>1111111</TD>

  </TR>

  <TR>

     <TD>22222222</TD>

  </TR>

</TABLE>
<TABLE border="1">

  <TR>

     <TD>AAA</TD>

     <TD>BBB</TD>

  </TR>

  <TR>

     <TD>aaa</TD>

     <TD>bbb</TD>

  </TR>

</TABLE>
<TABLE border="1">

  <TR>

     <TD>1111111</TD>

  </TR>

  <TR>

     <TD>22222222</TD>

  </TR>

</TABLE>

用HTML察看
1111111
22222222
AAA BBB
aaa bbb
1111111
22222222
XSLT stylesheet
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:variable name="A1">
     <xsl:copy-of select="//TABLE[1]"/>
</xsl:variable>
<xsl:variable name="A2">
     <xsl:copy-of select="//TABLE[2]"/>
</xsl:variable>
<xsl:template match="/">
     <xsl:copy-of select="$A2"/>
     <xsl:copy-of select="$A1"/>
     <xsl:copy-of select="$A2"/>
</xsl:template>


</xsl:stylesheet>



XSLT stylesheet 2

XML源码
<source>

<TABLE border="1">
     <TR>
          <TD>AAA</TD>
          <TD>BBB</TD>
     </TR>
     <TR>
          <TD>aaa</TD>
          <TD>bbb</TD>
     </TR>
</TABLE>
<TABLE border="1">
     <TR>
          <TD>1111111</TD>
     </TR>
     <TR>
          <TD>22222222</TD>
     </TR>
</TABLE>

</source>

输出
<P>

1111111


22222222

</P>
<P>

AAA
BBB


aaa
bbb

</P>
<P>

1111111


22222222

</P>

用HTML察看

1111111 22222222

AAA BBB aaa bbb

1111111 22222222

XSLT stylesheet
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:variable name="A1">
     <xsl:copy-of select="//TABLE[1]"/>
</xsl:variable>
<xsl:variable name="A2">
     <xsl:copy-of select="//TABLE[2]"/>
</xsl:variable>
<xsl:template match="/">
     <P>
          <xsl:value-of select="$A2"/>
     </P>
     <P>
          <xsl:value-of select="$A1"/>
     </P>
     <P>
          <xsl:value-of select="$A2"/>
     </P>
</xsl:template>


</xsl:stylesheet>


Kevin Carr in Stanton

Natural Skin Care and European Soaps
Kevin Carr
Mayor Dave Shawver Stanton
Internetusers

City Of Stanton | City Of Stanton | Warren Stanton Council and Gary Taylor Stanton | City Of Stanton |



Take a moment to visit 1cecilia438 or see them on twitter at 1cecilia410 or view them on facebook at hawaiian luxury shoes.

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