소스에서 출력으로 현재 노드를 복사합니다.
<xsl:copy
use-attribute-sets = QNames
</xsl:copy>
특성
- use-attribute-sets
정규화된 이름 목록으로 지정된 특성 집합 목록으로, 공백으로 구분되어 있습니다. 이 특성을 지정하면 나열된 각 특성 집합에서 각 특성이 선언됩니다.
요소 정보
발생 횟수 |
제한 없음 |
부모 요소 |
xsl:attribute, xsl:comment, xsl:copy, xsl:element, xsl:fallback, xsl:for-each, xsl:if, xsl:message, xsl:otherwise, xsl:param, xsl:processing-instruction, xsl:template, xsl:variable, xsl:when, xsl:with-param, 출력 요소 |
자식 요소 |
xsl:apply-templates, xsl:attribute, xsl:call-template, xsl:choose, xsl:comment, xsl:copy, xsl:copy-of, xsl:element, xsl:for-each, xsl:if, xsl:processing-instruction, xsl:text, xsl:value-of, xsl:variable, 출력 요소 |
주의
<xsl:copy>
요소는 현재 노드와 같은 이름, 네임스페이스 및 형식으로 출력에 노드를 만듭니다. 특성과 자식은 자동으로 복사되지 않습니다. 이 요소는 ID 변환을 가능하게 합니다.
예제
다음 예제에서는 전체 문서에 대해 ID 변환을 수행합니다. ID 변환은 소스의 각 노드를 출력에 복사하여 논리적으로 같은 트리를 제공합니다. 이는 문자별 동치를 생성하지 않습니다. 엔터티는 확장되며 공백은 제거될 수 있으므로 유효 공백으로 표시되지 않습니다.
XML 파일(booksshort.xml)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="identityxfm.xsl"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications with
XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen of the
world.</description>
</book>
<book id="bk103">
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-11-17</publish_date>
<description>After the collapse of a nanotechnology society
in England, the young survivors lay the foundation for a new
society.</description>
</book>
</catalog>
XSLT 파일(identityxfm.xsl)
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/ | @* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
출력
다음은 오른쪽이 잘린 형식이 지정된 출력의 한 부분입니다.
Gambardella, MatthewComputer44.952000-10-01An in-depth look and her own childhood to become queen of the world.Corets, EvaFa
다음은 프로세서 출력입니다.
<?xml version="1.0"?><?xml-stylesheet type="text/xsl"
href="identityxfm.xsl"?><catalog><book id="bk101"><author>Gambardella,
Matthew</author><title>XML Developer's
Guide</title><genre>Computer</genre><price>44.95</price><publish_date>2000
-10-01</publish_date><description>An in-depth look at creating
applications with
XML.</description></book><book id="bk102">
...
</book></catalog>