Funzione local-name
Restituisce la parte locale del nome espanso del nodo nell'argomento set di nodi che è primo in base all'ordine con cui è riportato nel documento.
string local-name(node-set?)
Osservazioni
In genere, un nome espanso è formato da un URI dello spazio dei nomi (o da un prefisso associato), dai due punti (:) e dalla parte locale. Ad esempio, b:author
è un nome espanso, dove b
è il prefisso URI dello spazio dei nomi e author
è la parte locale. Ne consegue che, se si applica la funzione local-name()
a questo nodo, verrà restituito author
. Se un nodo non presenta un nome espanso, ad esempio author
, applicando la funzione local-name()
su questo nodo, ne verrà restituito il nome, ad esempio author
.
Se l'argomento node-set viene omesso, viene utilizzato per impostazione predefinita un argomento node-set con il nodo di contesto come unico membro.
Esempio
File XML (data.xml)
File XSLT (sample.xsl)
File XSLT ausiliario (book-schema.xml)
Output formattato
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.
Output del processore
<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>