Hi,
I haven't heard from anyone - can anyone comment on if this is a bug or not?
Thanks,
Susan *********************************
Hello,
I'm attempting to use the local-name() function to match attributes with the same name in different namespaces in an xml document. The pattern I am attempting to use succeeds using the Xalan processor, but using xsltproc it gives me an error.
Here is the xml doc:
<?xml version="1.0" encoding="UTF-8"?>
<car:cars xmlns:car="http://www.example.com/xmlns/car"
xmlns:m="http://www.example.com/xmlns/manufacturer">
<car:models>
<car:model car:name="Rabbit" m:id="VW" car:year="1984" />
<car:model car:name="Tundra" m:id="TY" car:year="2000" />
<car:model car:name="Mini" m:id="BM" car:year="2003" />
</car:models>
<m:manufacturers>
<m:manufacturer m:id="VW" m:name="Volkswagen" m:country="Germany" />
<m:manufacturer m:id="TY" m:name="Toyota" m:country="Japan" />
<m:manufacturer m:id="BM" m:name="Bavarian Motor Works" m:country="Germany"/>
</m:manufacturers>
</car:cars>
Here is the xsl doc:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:car="http://www.example.com/xmlns/car"
xmlns:manu="http://www.example.com/xmlns/manufacturer">
<xsl:output method="text" encoding="UTF-8" />
<xsl:strip-space elements="*" />
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="car:models">
<xsl:text>My Car Models:
</xsl:text>
<xsl:apply-templates select="car:model/@car:name"></xsl:apply-templates>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="manu:manufacturers">
<xsl:text>The Manufacturers:
</xsl:text>
<xsl:apply-templates select="manu:manufacturer/@manu:name"></xsl:apply-templ
ates>
</xsl:template>
<xsl:template match="@*[local-name()='name']">
<xsl:value-of select="." />
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
When I attempt to use xsltproc here are the results;
compilation error: file input.xsl line 25 element template
xsltCompilePattern : failed to compile '@*[local-name()='name']'
The result using xalan is what I had hoped for:
My Car Models:
Rabbit
Tundra
Mini
The Manufacturers:
Volkswagen
Toyota
Bavarian Motor Works
If I change the input xml doc so that name is an element instead of an attribute and change my xsl doc to select for this, that works. So, instead of this;
<xsl:template match="@*[local-name()='name']">
I have this;
<xsl:template match="*[local-name()='name']">
xsltproc will select the names of the models and manufacturers correctly.
Does libxslt implement this functionality different than Xalan (if so can someone tell me the proper usage) or is this a bug?
The release of xsltproc I am using:
Using libxml 20426, libxslt 10022 and libexslt 713
xsltproc was compiled against libxml 20426, libxslt 10022 and libexslt 713
libxslt 10022 was compiled against libxml 20426
libexslt 713 was compiled against libxml 20426
Thanks for your help,
Susan Cline