text() in XPath limited in xsltproc?

A

Arndt Jonasson

The way I read the XPath 1.0 specification, queries like "//*/
text()/.." and
"//*/child::text()" should be valid. xmllint seems to agree with me,
but xsltproc gives syntax errors for those constructions.
Which one is correct?

$ xsltproc err1.xsl -
error
xsltCompileStepPattern : 'child' or 'attribute' expected
compilation error: file err1.xsl line 6 element template
xsltCompilePattern : failed to compile '//*/text()/parent::node()'

$ xsltproc err2.xsl -
error
xsltCompileStepPattern : Name expected
compilation error: file err2.xsl line 6 element template
xsltCompilePattern : failed to compile '//*/text()/node()/..'


Versions:
$xsltproc --version
Using libxml 20621, libxslt 10115 and libexslt 812
xsltproc was compiled against libxml 20620, libxslt 10115 and libexslt
812
libxslt 10115 was compiled against libxml 20620
libexslt 812 was compiled against libxml 20620
$ xmllint --version
xmllint: using libxml version 20627
compiled with: Threads Tree Output Push Reader Patterns Writer
SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer
XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas
Schematron Modules Debug
 
P

Pavel Lepin

Arndt Jonasson said:
The way I read the XPath 1.0 specification, queries like
"//*/ text()/.." and "//*/child::text()" should be valid.

They are, but not in match expressions. (However, libxslt
*does* allow those in match expressions as well. Xalan and
Saxon both choke on them, as the spec says they should.)
xmllint seems to agree with me, but xsltproc gives syntax
errors for those constructions. Which one is correct?

$ xsltproc err1.xsl -
error
xsltCompileStepPattern : 'child' or 'attribute' expected
compilation error: file err1.xsl line 6 element template
xsltCompilePattern : failed to compile
'//*/text()/parent::node()'

$ xsltproc err2.xsl -
error
xsltCompileStepPattern : Name expected
compilation error: file err2.xsl line 6 element template
xsltCompilePattern : failed to compile
'//*/text()/node()/..'

Versions:
$xsltproc --version
Using libxml 20621, libxslt 10115 and libexslt 812
xsltproc was compiled against libxml 20620, libxslt 10115
and libexslt 812
libxslt 10115 was compiled against libxml 20620
libexslt 812 was compiled against libxml 20620
$ xmllint --version
xmllint: using libxml version 20627
compiled with: Threads Tree Output Push Reader Patterns
Writer
SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath
XPointer XInclude Iconv ISO8859X Unicode Regexps Automata
Expr Schemas Schematron Modules Debug

Well, I can't reproduce your problem with:

pavel@debian:~/dev/xslt$ xsltproc -V
Using libxml 20629, libxslt 10121 and libexslt 813
xsltproc was compiled against libxml 20628, libxslt 10121
and libexslt 813
libxslt 10121 was compiled against libxml 20628
libexslt 813 was compiled against libxml 20628

You didn't give enough context to be sure, but I'd bet this
has been fixed between 2.6.21 and 2.6.27. Note that your
xsltproc uses 2.6.21. I know for sure there was an obscure
known bug with xpath.c in libxml 2.6.26 that was fixed
since then, so I think updating your packages should solve
your immediate problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top