Xslt中的Xsl:copy与Xsl:copy-of的区别

copy 和 copy-of 结构是用来复制节点的。copy 元素只复制当前节点,不带子节点和属性。而 copy-of 却统统复制。

XSLT stylesheet 1


XML源码
<source>

<p id="a12"> Compare
     <B>these constructs</B>.
</p>

</source>

输出
<DIV>
  <B>copy-of : </B>
  <p id="a12">
Compare <B>these constructs</B>.
</p>
</DIV>
<DIV>
  <B>copy : </B>
  <p/>
</DIV>
<DIV>
  <B>value-of : </B>
Compare these constructs.
</DIV>

用HTML察看
copy-of :

Compare these constructs.

copy :

 

value-of : Compare these constructs.
XSLT stylesheet
< xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

< xsl:template match="p">
     < DIV>
          < B>
               < xsl:text>copy-of : </ xsl:text>
          </ B>
          < xsl:copy-of select="."/>
     </ DIV>
     < DIV>
          < B>
               < xsl:text>copy : </ xsl:text>
          </ B>
          < xsl:copy/>
     </ DIV>
     < DIV>
          < B>
               < xsl:text>value-of : </ xsl:text>
          </ B>
          < xsl:value-of select="."/>
     </ DIV>
</ xsl:template>


</ xsl:



style="WIDTH: 490px; HEIGHT: 150px" align="center" marginwidth="0" marginheight="0" src="http://www.bloggao.com/script.aspx?userid=26256&AdType=0&AdstyleID=31302&Direction=1" frameborder="0" width="490" scrolling="no" height="150"> 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值