XSLT 키() 기능
❮ XSLT 기능 참조정의 및 사용
key() 함수는 <xsl:key> 요소에 의해 지정된 인덱스를 사용하여 문서에서 노드 집합을 반환합니다.
통사론
node-set key(string, object)
매개변수
Parameter | Description |
---|---|
string | Required. Specifies the name of an xsl:key element |
object | Required. A string to search for |
실시예 1
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="cdlist" match="cd" use="title" />
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="key('cdlist', 'Empire Burlesque')">
<p>
Title: <xsl:value-of select="title" />
<br />
Artist: <xsl:value-of select="artist" />
<br />
Price: <xsl:value-of select="price" />
</p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XML 파일 보기 , XSL 파일 보기 및 결과 보기 .
❮ XSLT 기능 참조