XSLT <xsl:값-의>
❮ XSLT 요소 참조
정의 및 사용
<xsl:value-of> 요소는 선택된 노드의 값을 추출합니다.
<xsl:value-of> 요소는 XML 요소의 값을 선택하고 출력에 추가하는 데 사용할 수 있습니다.
통사론
<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" |
예
아래 예는 첫 번째 제목 및 아티스트 요소의 값을 넣고 테이블에 넣습니다.
실시예 1
<?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>
아래 예는 각 cd 요소를 반복하고 각 cd 요소에 대한 제목 및 아티스트의 값으로 테이블 행을 생성합니다.
실시예 2
<?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 요소 참조