only for RuBoard |
xsl:copy-of inserts subtrees into the result document without converting the result into a string.
It's similar to xsl:copy , but provides an explicit select attribute to specify the fragment to be included.
Attribute Name | Enforced | Description | Values |
---|---|---|---|
Select | Required | The name of the template rule to call | QName |
Given the XML instance document, links.xml .
<?xml version="1.0" encoding="utf-8" ?> <links> <link> <name>NewRiders.com</name> <URL>http://www.newriders.com</URL> </link> <link> <name>Xmlandasp.net</name> <URL>http://www.xmlandasp.net</URL> </link> </links>
The preceding stylesheet used for the xsl:copy example is modified so that only a single template rule is needed to match the root node. The character entity reference # is used to display the pound ( # ) symbol because the # symbol has meaning in XSLT.
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xml> <xsl:attribute name="id">dataisland</xsl:attribute> <xsl:copy-of select="@* node()" /> </xml> <table border="1" datasrc="#dataisland"> <tr> <td> <div> <xsl:attribute name="datafld">name</xsl:attribute> </div> </td> <td> <div> <xsl:attribute name="datafld">URL</xsl:attribute> </div> </td> </tr> </table> </xsl:template> </xsl:stylesheet>
This results in the following output, which is the same output yielded in the xsl:copy example.
<?xml version="1.0" encoding="UTF-16" ?> <xml id="dataisland"> <links> <link> <name>NewRiders.com</name> <URL>http://www.newriders.com</URL> </link> <link> <name>Xmlandasp.net</name> <URL>http://www.xmlandasp.net</URL> </link> </links> </xml> <table border="1" datasrc="#dataisland"> <tr> <td><div datafld="name" /></td> <td><div datafld="URL" /></td> </tr> </table>
When this document is viewed in Internet Explorer 5.0 or higher as an HTML document, the following HTML table is visible in the browser.
NewRiders.com | www.newriders.com |
Xmlandasp.net | www.xmlandasp.net |
xsl:attribute, xsl:comment, xsl:copy, xsl:element, xsl:for-each, xsl:if, xsl:otherwise, xsl:param, xsl:processing-instruction, xsl:template, xsl:variable, xsl:when, xsl:with-param, output elements
None.
only for RuBoard |