Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Gibt den lokalen Teil des erweiterten Namens des Knotens im node-set-Argument zurück, das in der Dokumentreihenfolge an erster Stelle steht.
string local-name(node-set?)
Hinweise
Erweiterte Namen bestehen i. d. R. aus einem Namespace-URI (oder zugeordnetem Präfix), einem Doppelpunkt (:) und einem lokalen Teil. b:author ist beispielsweise ein erweiterter Name, wobei b das Namespace-URI-Präfix und author den lokalen Teil darstellt. Daher wird author zurückgegeben, wenn die local-name()-Funktion auf diesen Knoten angewendet wird. Wenn ein Knoten keinen erweiterten Namen aufweist, z. B. author, wird bei Anwendung der local-name()-Funktion auf diesen Knoten der Knotenname zurückgegeben, z. B. author.
Wenn das node-set-Argument ausgelassen wird, erfolgt als Standard eine Konvertierung in eine Knotengruppe mit dem Kontextknoten als einzigem Member.
Beispiel
XML-Datei (data.xml)
<?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-Datei (sample.xsl)
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<body>
<h3>local-name() Function</h3>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="*">
<xsl:value-of select="local-name()"/> = <xsl:value-of select="text()"/><br/>
<xsl:apply-templates select="*"/>
</xsl:template>
</xsl:stylesheet>
XSLT-Hilfsdatei (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>
Formatierte Ausgabe
local-name() Function
catalog =
book =
author = Gambardella, Matthew
title = XML Developer's Guide
genre = Computer
price = 44.95
publish_date = 2000-10-01
description = An in-depth look at creating applications with XML.
book =
author = Ralls, Kim
title = Midnight Rain
genre = Fantasy
price = 5.95
publish_date = 2000-12-16
description = A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.
Prozessorausgabe
<html>
<body>
<h3>local-name() Function</h3>catalog = <br>book = <br>author = Gambardella, Matthew<br>title = XML Developer's Guide<br>genre = Computer<br>price = 44.95<br>publish_date = 2000-10-01<br>description = An in-depth look at creating applications with XML.<br>book = <br>author = Ralls, Kim<br>title = Midnight Rain<br>genre = Fantasy<br>price = 5.95<br>publish_date = 2000-12-16<br>description = A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.<br></body>
</html>