GNOME Bugzilla – Bug 64044
Whitespaces in XPath-expressions
Last modified: 2009-08-15 18:40:50 UTC
When using the xsl:template element there are problems with whitespaces in XPath-expressions in the attribute 'match'. Designing the source code I tried to insert whitespaces (newlines) in an XPath-expression. Example (newline after every predicate): <xsl:template match="abbildung[@groesse = 100] | abbildung[@groesse > 50] [legende or beschreibung] [@ausrichtung != 'rechts'] [@ausrichtung != 'kompakt']"> Running xsltproc doesn't work correctly. There are also no error messages. The only way to successfully transform the document was to remove all whitespaces (newlines). There were no problems when using the same stylesheets with xalan or IE 5.x. Can you tell me whether it is possible to use whitespaces in XPath- expressions?
Don't understand where the problem might be coming from ! I checked the XPath parser code and it does skip blanks between consecutive predicates. I can't reproduce the problem, provide input (XML + XSLT) as well as making sure your are using a recent version, if you want me to investigate further. Daniel
Okay, I found the bug and fixed it in CVS. The problem was not at the XPath compilation level but in template matches compilation, I forgot to add an instruction to skip blanks between consecutive predicates at that level ! http://cvs.gnome.org/bonsai/cvsquery.cgi?module=libxslt&branch=HEAD&branchtype=match&dir=libxslt&file=&filetype=match&who=veillard&whotype=match&sortby=Date&hours=&date=explicit&mindate=11%2F26%2F01+05%3A22&maxdate=11%2F26%2F01+05%3A24&cvsroot=%2Fcvs%2Fgnome Very small patch but seems to fix the bug, thanks a lot for the report, Daniel