Nic Miloslav     Example 55    KEYWORDS      EXAMPLES      AUTHORS     

A variable can hold a result tree fragment. The operations permitted on a result tree fragment are a subset of those permitted on a node-set. An operation is permitted on a result tree fragment only if that operation would be permitted on a string (the operation on the string may involve first converting the string to a number or boolean). In particular, it is not permitted to use the /, //, and [] operators on result tree fragments. When a permitted operation is performed on a result tree fragment, it is performed exactly as it would be on the equivalent node-set. Compare Stylesheet 1 and Stylesheet 2.


     XML     HOME     XSL 1     XSL 2      
<xslTutorial >
 <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>
  
</xslTutorial>

     XSL 1     HOME     XML     HTML 1     OUTPUT 1     
<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>

     HTML 1     HOME     XML     XSL 1     OUTPUT 1     
<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>

     OUTPUT 1     HOME