<xsl:attribute> 的示例 1

本示例复制 <myElement> 元素并添加一个有 "true" 值的 copied 属性。

XML 文件 (myelem.xml)

XSLT 文件 (attrcopied.xsl)

输出

以下是格式化输出:

My DataMy Other Data

以下是处理器输出,为了清楚起见,增加了分行符。

<?xml version="1.0"?>

<myElement copied="true">My Data</myElement>

<myElement copied="true">My Other Data</myElement>