您现在的位置: 365建站网 > 建站教程 > XSLT 教程 > XSLT <xsl:copy-of> 元素

XSLT <xsl:copy-of> 元素

此节有 119 人学习过     参与评论

定义和用法

<xsl:copy-of> 元素可创建当前节点的一个副本。

注释:当前节点的 Namespace 节点、子节点以及属性都会被自动复制!

提示:该元素可用于把相同节点的多个副本插入到输出的不同位置。

语法

</>code

  1. <xsl:copy-of select="expression"/>

属性

属性 描述
select expression 必需。规定要拷贝的内容。

实例

例子 1

</>code

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <xsl:stylesheet version="1.0"
  3. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  4. <xsl:variable name="header">
  5. <tr>
  6. <th>Element</th>
  7. <th>Description</th>
  8. </tr>
  9. </xsl:variable>
  10. <xsl:template match="/">
  11. <html>
  12. <body>
  13. <table>
  14. <xsl:copy-of select="$header" />
  15. <xsl:for-each select="reference/record">
  16. <tr>
  17. <xsl:if test="category='XML'">
  18. <td><xsl:value-of select="element"/></td>
  19. <td><xsl:value-of select="description"/></td>
  20. </xsl:if>
  21. </tr>
  22. </xsl:for-each>
  23. </table>
  24. <br />
  25. <table>
  26. <xsl:copy-of select="$header" />
  27. <xsl:for-each select="table/record">
  28. <tr>
  29. <xsl:if test="category='XSL'">
  30. <td><xsl:value-of select="element"/></td>
  31. <td><xsl:value-of select="description"/></td>
  32. </xsl:if>
  33. </tr>
  34. </xsl:for-each>
  35. </table>
  36. </body>
  37. </html>
  38. </xsl:template>
  39. </xsl:stylesheet>

如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛

您可能感兴趣的文章:

发表评论 (119人查看0条评论)
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
昵称:
最新评论
------分隔线----------------------------
XSLT 教程目录

快速入口

· 365软件
· 杰创官网
· 建站工具
· 网站大全

其它栏目

· 建站教程
· 365学习

业务咨询

· 技术支持
· 服务时间:9:00-18:00
365建站网二维码

Powered by 365建站网 RSS地图 HTML地图

copyright © 2013-2024 版权所有 鄂ICP备17013400号