中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

XSLT xsl:value-of 元素


XSLT 元素參考手冊(cè) XSLT 元素參考手冊(cè)

定義和用法

<xsl:value-of> 元素可提取選定節(jié)點(diǎn)的值。

<xsl:value-of> 元素可用于選取某個(gè) XML 元素的值,并把它輸出。


語(yǔ)法

<xsl:value-of select="expression" disable-output-escaping="yes|no" />

屬性

屬性 描述
select expression 必需。一個(gè) XPath 表達(dá)式,規(guī)定了從哪個(gè)節(jié)點(diǎn)/屬性來提取值。它的工作原理與通過正斜杠(/)選擇子目錄的導(dǎo)航文件系統(tǒng)類似。
disable-output-escaping yes
no
可選。如果值為 "yes",通過實(shí)例化 <xsl:text> 元素生成的文本節(jié)點(diǎn)在輸出時(shí)將不進(jìn)行任何轉(zhuǎn)義。比如 "<" 將輸出為 "<"。如果值為 "no",則 "<" 將輸出為 "&lt;"。默認(rèn)是 "no"。

實(shí)例

下面的實(shí)例獲取第一個(gè) title 和 artist 元素的值,并放置在表格中:

實(shí)例 1

<?xml version="1.0" encoding="ISO-8859-1"?>
<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>

運(yùn)行代碼 ?

下面的實(shí)例循環(huán)遍歷每個(gè) cd 元素,并創(chuàng)建帶有每個(gè) cd 元素的 title 和 artist 的值的表格行:

實(shí)例 2

<?xml version="1.0" encoding="ISO-8859-1"?>
<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>

運(yùn)行代碼 ?

XSLT 元素參考手冊(cè) XSLT 元素參考手冊(cè)其他擴(kuò)展