XSLT <xsl:복사본>
❮ 완전한 XSLT 요소 참조
정의 및 사용
<xsl:copy-of> 요소는 현재 노드의 복사본을 만듭니다.
참고: 네임스페이스 노드, 자식 노드 및 현재 노드의 속성도 자동으로 복사됩니다!
팁: 이 요소는 동일한 노드의 여러 복사본을 출력의 다른 위치에 삽입하는 데 사용할 수 있습니다.
통사론
<xsl:copy-of select="expression"/>
속성
Attribute | Value | Description |
---|---|---|
select | expression | Required. Specifies what to be copied |
실시예 1
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="header">
<tr>
<th>Element</th>
<th>Description</th>
</tr>
</xsl:variable>
<xsl:template match="/">
<html>
<body>
<table>
<xsl:copy-of select="$header" />
<xsl:for-each select="reference/record">
<tr>
<xsl:if test="category='XML'">
<td><xsl:value-of select="element"/></td>
<td><xsl:value-of select="description"/></td>
</xsl:if>
</tr>
</xsl:for-each>
</table>
<br />
<table>
<xsl:copy-of select="$header" />
<xsl:for-each select="table/record">
<tr>
<xsl:if test="category='XSL'">
<td><xsl:value-of select="element"/></td>
<td><xsl:value-of select="description"/></td>
</xsl:if>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
❮ 완전한 XSLT 요소 참조