XSLT <xsl:value-of>
❮ XSLT Element ရည်ညွှန်းချက်
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
<xsl:value-of> ဒြပ်စင်သည် ရွေးချယ်ထားသော node ၏တန်ဖိုးကို ထုတ်ယူသည်။
XML ဒြပ်စင်တစ်ခု၏တန်ဖိုးကို ရွေးချယ်ပြီး ၎င်းကို အထွက်တွင်ထည့်ရန် <xsl:value-of> ဒြပ်စင်ကို အသုံးပြုနိုင်သည်။
အထားအသို
<xsl:value-of
select="expression"
disable-output-escaping="yes|no" />
ဂုဏ်တော်
Attribute | Value | Description |
---|---|---|
select | expression | Required. An XPath expression that specifies which node/attribute to extract the value from. It works like navigating a file system where a forward slash (/) selects subdirectories. |
disable-output-escaping | yes no |
Optional. "yes" indicates that special characters (like "<") should be output as is. "no" indicates that special characters (like "<") should be output as "<". Default is "no" |
ဥပမာများ
အောက်ဖော်ပြပါ ဥပမာသည် ပထမခေါင်းစဉ်နှင့် အနုပညာရှင်ဒြပ်စင်များမှ တန်ဖိုးများကို ထည့်သွင်းပြီး ဇယားတစ်ခုတွင် ထည့်သည်-
ဥပမာ ၁
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h1>Music Collection:</h1>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<tr>
<td><xsl:value-of select="catalog/cd/title"
/></td>
<td><xsl:value-of select="catalog/cd/artist"
/></td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
အောက်ဖော်ပြပါ ဥပမာသည် စီဒီဒြပ်စင်တစ်ခုစီကို လှည့်ပတ်ပြီး စီဒီဒြပ်စင်တစ်ခုစီအတွက် ခေါင်းစဉ်နှင့် အနုပညာရှင်မှ တန်ဖိုးများပါသည့် ဇယားအတန်းတစ်ခုကို ဖန်တီးသည်-
ဥပမာ ၂
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h1>Music Collection:</h1>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"
/></td>
<td><xsl:value-of select="artist"
/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
❮ XSLT Element ရည်ညွှန်းချက်