XSLT <xsl:copy-of>
❮ XSLT ဒြပ်စင် အကိုးအကားကို အပြီးသတ်ပါ။
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
<xsl:copy-of> ဒြပ်စင်သည် လက်ရှိ node ၏ မိတ္တူကို ဖန်တီးသည်။
မှတ်ချက်- Namespace nodeများ၊ ကလေး node များနှင့် လက်ရှိ node များ၏ attribute များကိုလည်း အလိုအလျောက် ကူးယူပါသည်။
အကြံပြုချက်- ဤဒြပ်စင်အား တူညီသော node အများအပြားကို အထွက်တွင် မတူညီသောနေရာများတွင် ထည့်သွင်းရန် အသုံးပြုနိုင်သည်။
အထားအသို
<xsl:copy-of select="expression"/>
ဂုဏ်တော်
Attribute | Value | Description |
---|---|---|
select | expression | Required. Specifies what to be copied |
ဥပမာ ၁
<?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 ဒြပ်စင် အကိုးအကားကို အပြီးသတ်ပါ။