D
douglasforrest
I have a well-formed UTF-16 document which looks something like this:
<?xml version="1.0" encoding="UTF-16"?>
<alerts>
<alert id="15670">
<name>Test</name>
</alert>
<alert id="15671">
<name>Another Test</name>
</alert>
</alerts>
After parsing using XML::LibXML, findnodes using "//alert" from the
root element
@nodes = $root->findnodes('//alert'))
produces an XPath Invalid expression error.
Findnodes using "/alert" does not trigger an error but produces 0
nodes.
Applying an XSLT stylesheet via XML::LibXSLT using "//alert" runs fine
and produces the expected 2 results.
The stylesheet looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="//alert">
<xsl:value-of select="name"/><br/>
</xsl:template>
</xsl:stylesheet>
Any suggestions would be much appreciated.
<?xml version="1.0" encoding="UTF-16"?>
<alerts>
<alert id="15670">
<name>Test</name>
</alert>
<alert id="15671">
<name>Another Test</name>
</alert>
</alerts>
After parsing using XML::LibXML, findnodes using "//alert" from the
root element
@nodes = $root->findnodes('//alert'))
produces an XPath Invalid expression error.
Findnodes using "/alert" does not trigger an error but produces 0
nodes.
Applying an XSLT stylesheet via XML::LibXSLT using "//alert" runs fine
and produces the expected 2 results.
The stylesheet looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="//alert">
<xsl:value-of select="name"/><br/>
</xsl:template>
</xsl:stylesheet>
Any suggestions would be much appreciated.