[xslt] lang function weirdness



Given this XML document:

<a><x>1</x><b xml:lang="en"><x>en</x><x>3</x></b><x>4</x></a>

Apply this stylesheet:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match='/'>
  <xsl:apply-templates select="//*[lang('')]"/>
</xsl:template>

</xsl:stylesheet>

The result is

~$ xsltproc -version
Using libxml 20611, libxslt 10108 and libexslt 806
xsltproc was compiled against libxml 20611, libxslt 10108 and libexslt 806
libxslt 10108 was compiled against libxml 20611
libexslt 806 was compiled against libxml 20611
~$ xsltproc test.xsl test.xml
<?xml version="1.0"?>
en3en3

In other words, the empty string is matching the language code. I don't think it should be doing that.

--
Elliotte Rusty Harold  elharo metalab unc edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]