Name

local-name() Function — Returns the local part of the first node in the argument node-set.

Synopsis

string local-name(
               node-set?
               )

Inputs

A node-set. If the node-set is empty, the function returns an empty string. If the node-set is omitted, the function uses a node-set with the context node as its only member.

Output

A string corresponding to the local name of the first element in the argument node-set. If the node-set is empty, the local-name() function returns an empty string.

Defined in

XPath section 4.1, Node Set Functions.

Example

Here is a stylesheet that uses the document() function to process all its own nodes. It then calls the local-name() function against each node.

<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:months="Lookup table for month names"> <months:name sequence="12">December</months:name> <months:name sequence="01">January</months:name> <months:name sequence="02">February</months:name> <months:name sequence="03">March</months:name> <months:name sequence="04">April</months:name> <months:name sequence="05">May</months:name> <months:name sequence="06">June</months:name> <months:name sequence="07">July</months:name> <months:name sequence="08">August</months:name> <months:name sequence="09">September</months:name> <months:name sequence="10">October</months:name> <months:name sequence="11">November</months:name> <xsl:output method="text"/> <xsl:variable name="newline"> <xsl:text> </xsl:text> </xsl:variable> ...

Get XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.