473,383 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

text() in XPath limited in xsltproc?


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

Aug 8 '07 #1
1 2663

Arndt Jonasson <ar************@gmail.comwrote in
<11**********************@o61g2000hsh.googlegroups .com>:
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.

--
....the pleasure of obedience is pretty thin compared with
the pleasure of hearing a rotten tomato hit someone in the
rear end. -- Garrison Keillor
Aug 8 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Vincent Lefevre | last post by:
Hello, The XPath 1.0 recommendation says: A number represents a floating-point number. A number can have any double-precision 64-bit format IEEE 754 value . These include a special...
6
by: Scott Simpson | last post by:
What is a good tool for running XPath queries on Linux? I have the O'Reilly XPath book and I'm using XPath Visualizer on Windows and that seems to work fine, but I'm looking for something on Linux....
2
by: nkunapa | last post by:
Hi: Is there a way in XPATH to find the nearest node of the node in context with a certain attribute value. Here is my problem. I have the following XML and I am trying to add all the nodes with...
1
by: Loudin | last post by:
Hello, I`ve got Problems with Xpath and xsltproc/libxslt. I have got a variable with tags in my Style sheet and later in the same Style sheet i want to work with this tags using a...
3
by: Alois Treindl | last post by:
A simple XSL question from a newbie: In an xml document which I transform via xsl into html output, I have some text which I want to be suppressed. The tags looks like this <anchor_ref...
2
by: Ramon | last post by:
Hello, How to pass parameter with acute accent to xsltproc ? example : (été (french) = summer) $ xsltproc --stringparam ch été fichier.xsl fichier.xml It is written in the xsltproc man...
14
by: Mat| | last post by:
Hello :-) I am learning XPath, and I am trying to get child nodes of a node whose names do *not* match a given string, e.g : <dummy> <example> <title>Example 1</title> <body>this is an...
1
by: Arndt Jonasson | last post by:
I have this xslt transform ex.xsl and an instance document ex.xml: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> ...
2
by: A. W. Dunstan | last post by:
I'm trying to figure out how XPath expressions work, and how I can use them to extract data into a particular format. I can extract the data I want using an XPath expression, but not with an XSLT...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.