첫 번째 문서의 노드 집합 인수에서 노드의 확장 이름을 나타내는 QName이 포함된 문자열을 반환합니다.
string name(node-set?)
주의
QName은 노드에 적용된 네임스페이스에 대한 확장 이름을 나타내야 합니다. 그러나 여러 접두사가 같은 네임스페이스에 연결된 노드에 네임스페이스 선언이 적용된 경우 반드시 필요하지는 않습니다. 노드 집합 인수가 비어 있거나 첫 번째 노드에 확장 이름이 없을 경우 빈 문자열이 반환됩니다. 이 인수를 생략하면 유일한 멤버로 컨텍스트 노드가 있는 노드 집합을 기본값으로 설정합니다.
예제
XML 파일(bcat.xml)
<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="sample.xsl"?>
<b:catalog xmlns:b="x-schema:book-schema.xml">
<b:book id="bk101">
<b:author>Gambardella, Matthew</b:author>
<b:title>XML Developer's Guide</b:title>
<b:genre>Computer</b:genre>
<b:price>44.95</b:price>
<b:publish_date>2000-10-01</b:publish_date>
<b:description>An in-depth look at creating applications with XML.</b:description>
</b:book>
<b:book id="bk102">
<b:author>Ralls, Kim</b:author>
<b:title>Midnight Rain</b:title>
<b:genre>Fantasy</b:genre>
<b:price>5.95</b:price>
<b:publish_date>2000-12-16</b:publish_date>
<b:description>A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.</b:description>
</b:book>
</b:catalog>
XSLT 파일(sample.xsl)
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<body>
<h3>name() Function</h3>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="*">
<xsl:value-of select="name()"/> = <xsl:value-of select="text()"/><br/>
<xsl:apply-templates select="*"/>
</xsl:template>
</xsl:stylesheet>
보조 XSLT 파일(book-schema.xml)
<Schema name="books" xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:datatypes">
<ElementType name="author"/>
<ElementType name="title"/>
<ElementType name="genre"/>
<ElementType name="price"/>
<ElementType name="publish_date"/>
<ElementType name="description"/>
<AttributeType name="id" dt:type="id"/>
<ElementType name="catalog">
<element type="book"/>
</ElementType>
<ElementType name="book" model="closed" content="eltOnly">
<attribute type="id"/>
<element type="author"/>
<element type="title"/>
<element type="genre"/>
<element type="price"/>
<element type="publish_date"/>
<element type="description"/>
</ElementType>
</Schema>
서식이 지정된 출력
name() Function
b:catalog =
b:book =
b:author = Gambardella, Matthew
b:title = XML Developer's Guide
b:genre = Computer
b:price = 44.95
b:publish_date = 2000-10-01
b:description = An in-depth look at creating applications with XML.
b:book =
b:author = Ralls, Kim
b:title = Midnight Rain
b:genre = Fantasy
b:price = 5.95
b:publish_date = 2000-12-16
b:description = A former architect battles corporate zombies, an evil sorceress, and
her own childhood to become queen of the world.
프로세서 출력
<html>
<body>
<h3>name() Function</h3>b:catalog = <br>b:book = <br>b:author = Gambardella, Matthew<br>b:title = XML Developer's Guide<br>b:genre = Computer<br>b:price = 44.95<br>b:publish_date = 2000-10-01<br>b:description = An in-depth look at creating applications with XML.<br>b:book = <br>b:author = Ralls, Kim<br>b:title = Midnight Rain<br>b:genre = Fantasy<br>b:price = 5.95<br>b:publish_date = 2000-12-16<br>b:description = A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.<br></body>
</html>