After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 158553 - Non-standard behavior on invalid XPath
Non-standard behavior on invalid XPath
Status: VERIFIED DUPLICATE of bug 153094
Product: libxslt
Classification: Platform
Component: general
1.1.11
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2004-11-17 13:31 UTC by Frans Englich
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Frans Englich 2004-11-17 13:31:45 UTC
Please describe the problem:
 
In an XSLT sheet with: 
 
    <xsl:template match="/"> 
        <xsl:template match="@id=''" /> 
    </xsl:template> 
 
xsltproc silently exits, printing: 
xsltApplyOneTemplate: template was not compiled 
 
Which is rather cryptic and internal(I can't tell what's wrong). I would like 
to know /where/ "it" was wrong(file, line number), and /what/ was wrong with 
the XPath. 
 
Also, I don't know if it's even valid XPath(it selects attribute nodes from the 
current node that are empty?), but in case it isn't, I guess xsltproc should 
stop processing. 
 
Another thing: I managed to misspell the xml processing instruction, and 
xsltproc didn't barf: <?uxml version="1.0" encoding="UTF-8" ?>. Should XML 
processors silently accept processing instructions they don't understand? 
 
Cheers, 
Frans 
 
 
 

Steps to reproduce:
 

Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Daniel Veillard 2004-11-17 14:19:48 UTC
for point 1/ template is not compiled because it is not a child of the
stylesheet element. This is a duplicate of bug #153094 your stylesheet is
broken but the compilation process did not detect it it should have failed
to compile it in the first place. The XPath expression is not wrong, it's
the englobing template construct which is.

  => Duplicate of #153094

for point 2/ 
  - <?xml ... is an XML Declaration. This is *not* a Processing Instruction.
  - Processing Instructions can perfectly be placed at the top of a document.
    and an XML Declaration is not mandatory
  - the XML parser doesn't do any semantic processing for markup constructs
    that it doesn't know, this is true for name occuring everywhere in
    element, attributes, PIs. The only thing is that name starting with
    xml (case insensitive) are reserved for W3C XML specifications.

  => NOTABUG

Daniel

*** This bug has been marked as a duplicate of 153094 ***
Comment 2 Frans Englich 2004-11-18 16:39:23 UTC
Sorry for the bogus report, and thanks for telling about XML declarations. 
 
 
                Frans 
Comment 3 Daniel Veillard 2004-11-18 17:37:19 UTC
no problem see the following for the reference:

http://www.w3.org/TR/REC-xml/#NT-XMLDecl 

Daniel
Comment 4 Frans Englich 2004-11-19 18:18:36 UTC
<?xml version="1.0" encoding="UTF-8" ?> 
 
<xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    version="1.0"> 
 
    <xsl:template match="@id=''"/> 
 
    <xsl:template match="/" /> 
 
</xsl:stylesheet> 
 
 
If I run this with ` xsltproc test.xsl`(no document) I get: 
 
bash-2.05b$ xsltproc  test.xsl 
compilation error: file test.xsl line 5 element template 
xsltCompilePattern : failed to compile '@id=''' 
bash-2.05b$ 
 
I can't tell what's wrong, but you said the XPath was ok, so what is done 
wrong? 
 
 
Cheers, 
Frans 
 
Comment 5 Daniel Veillard 2004-11-19 22:48:06 UTC
A pattern match allows only a *subset* of the full XPath syntax

   http://www.w3.org/TR/xslt#NT-Pattern

For XSLT and XPath it is worth reading the specs, it's not XML Schemas
Structure, one can actually find the information there.
The fact that libxslt failed to compile '@id=''' sounds relatively clear to me.

Daniel
Comment 6 Daniel Veillard 2005-09-05 09:41:45 UTC
This should be closed by release of libxslt-1.1.15

  thanks,

Daniel