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 75813 - apply-templates on a node-set doesn't find match critieria correctly
apply-templates on a node-set doesn't find match critieria correctly
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Windows
: Normal normal
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2002-03-21 23:17 UTC by Mark Vakoc
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
source document (xml) (985 bytes, text/xml)
2002-03-21 23:17 UTC, Mark Vakoc
Details
stylesheet (1.64 KB, text/xml)
2002-03-21 23:17 UTC, Mark Vakoc
Details

Description Mark Vakoc 2002-03-21 23:17:03 UTC
original discussion from xslt mailing list:

On Thu, Mar 21, 2002 at 11:11:37AM -0700, Vakoc, Mark wrote:
> 
> The following stylesheet applys templates on identical xml, the first
> instance is in a variable/node-set, the second is from the source 
document.
> They xml is the same so the same template should be found for either.  
the
> template match is "DIRTREE[d][f]".  It finds the correct match on the 
xml on
> the source document, and incorrectly when from a node-set
> 
> Here's the interesting part.  If you remove one set of brackets from the
> match (i.e match="DIRTREE[d]") it will act correctly, so it appears that
> having multiple brackets in the match when run against a variable/node-
set
> will not work.  

  Yes. 

> Is this a bug or am I insane (or, possibly, both).

  Both. It's insane because initially the XSLT data model did NOT
allow that kind of constructs. It get possible only via the use of
the node-set extension and this create a huge amount of technical 
problems.

  a template matching DIRTREE[d][f] means it matches all the nodes
//DIRTREE[d][f] in the current document. the node set has no document
or if it has a document it is not reachable from the node itself.

  Log the bug please, but understand that the use and abuse of the
node-set extension was not initially part of the XSLT model.

Daniel
Comment 1 Mark Vakoc 2002-03-21 23:17:34 UTC
Created attachment 7301 [details]
source document (xml)
Comment 2 Mark Vakoc 2002-03-21 23:17:56 UTC
Created attachment 7302 [details]
stylesheet
Comment 3 Daniel Veillard 2002-04-14 14:35:18 UTC
I had a look at this, fairly hard, and possibly in conflict
with the way I fixed another bug on similar problem. I'm not
sure I will have the cycle to do this in the short term,
assigned pending a more general analysis of the problem

Daniel
Comment 4 Daniel Veillard 2003-03-24 14:08:15 UTC
Okay, I finally fixed it in CVS, it required changes to
both libxml2 and libxslt, the handling of result value tree
especially once cast using node-set() should be quite cleaner:

paphio:~/XSLT/tests/general -> xsltproc bug-111.xsl ../docs/bug-111.xml
<?xml version="1.0"?>
<root>
 Test 1
 DIRTREE : true : true
 Test 2
 DIRTREE : true : true</root>
paphio:~/XSLT/tests/general ->

  I just had to modify one thing on your example stylesheet,
the top of the RVT matches '/' and hence the stylesheet was
looping, so I needed to change slightly the stylesheet:

 Test 1
 <xsl:apply-templates select="exsl:node-set($dtree)/DIRTREE"/>
 Test 2

instead of

 Test 1
 <xsl:apply-templates select="exsl:node-set($dtree)"/>
 Test 2

  thanks for the report and testcases, sorry for the delay :-)

Daniel
Comment 5 Daniel Veillard 2003-04-01 14:52:31 UTC
  This should be closed by release of libxml2-2.5.6 and
libxslt-1.0.29,

    thanks,

Daniel