[xslt] name() = localname() ?
- From: Bernhard Zwischenbrugger <bz datenkueche com>
- To: xslt gnome org
- Subject: [xslt] name() = localname() ?
- Date: Fri, 26 Mar 2004 19:09:54 +0100
Hi all
I have a problem to get the namespace prefix of a node.
name() and local-name() always give the same result but
I want to get the node name with namespace prefix.
Maybe somebody can help me how to do that.
thanx
Bernhard
http://datenkueche.com
An Example:
=========
# more test.xml
<test xmlns="http://test.com"/>
=============================================
# more test.xslt
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:test="http://test.com"
>
<xsl:output indent="yes"/>
<xsl:template match="/">
<result>
<name>
<xsl:value-of select="name(/test:test)"/>
</name>
<local-name>
<xsl:value-of select="local-name(/test:test)"/>
</local-name>
</result>
</xsl:template>
</xsl:stylesheet>
===========================================
# xsltproc test.xslt test.xml
<?xml version="1.0"?>
<result xmlns:test="http://test.com">
<name>test</name> <------ where is the prefix ??
<local-name>test</local-name>
</result>
==========================================
EXPECTED RESULT:
<?xml version="1.0"?>
<result xmlns:test="http://test.com">
<name>test:test</name> <!-- HERE IS THE DIFFERENCE -->
<local-name>test</local-name>
</result>
==================================
# xsltproc -V
Using libxml 20607, libxslt 10104 and libexslt 804
xsltproc was compiled against libxml 20607, libxslt 10104 and libexslt 804
libxslt 10104 was compiled against libxml 20607
libexslt 804 was compiled against libxml 20607
========================================
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]