Re: [xslt] libxslt problem
- From: Justin Fletcher <justin fletcher ntlworld com>
- To: xslt gnome org
- Subject: Re: [xslt] libxslt problem
- Date: Fri, 28 Jun 2002 07:03:47 +0100
In message <5c6db74c4b.Justin@gerph.movspclr.co.uk>
Justin Fletcher <justin.fletcher@ntlworld.com> wrote:
> In message <285417F7D1B3D411A3690090276212111DE7C9@AKIR02>
> Paul Hermans <paul_hermans@protext.be> wrote:
>
> > Dear,
> >
> > Using
> > xsltproc --timing --output test.out phase3.xsl out2.xml 2>log.err
> >
> > raises following error messages.
> >
> > Parsing stylesheet phase3.xsl took 0 ms
> > Parsing document out2.xml took 70 ms
> > Error Invalid context position
> > xmlXPathCompiledEval: evaluation failed
> > Error Invalid context position
> > xmlXPathCompiledEval: evaluation failed
> > Running stylesheet and saving result took 10 ms
> >
> > All other xslt processors tested do not raise these errors.
>
> That's a somewhat huge file. It would have been nice if you could have
> produced a test case that failed which was slightly smaller than 600k.
> Or put a reference on to a site where it could be downloaded from. Not
> everyone is on broadband, y'know ?
>
> Reduced form of the problem attached; I don't know enough to see what's
> going on in the XSLT - it's far more complex than I can get my head around
> at the moment, but the reduced XML might give someone else an idea and the
> fact that they don't have to waste time reducing it themselves might mean
> it actually gets looked at by someone who can help.
>
> Similar tests performed :
>
> --8<--------
> *xsltproc --output test.out phase3.xsl linted3.xml
> Error Invalid context position
> xmlXPathCompiledEval: evaluation failed
> Error Invalid context position
> xmlXPathCompiledEval: evaluation failed
> Error Invalid context position
> xmlXPathCompiledEval: evaluation failed
> --8<--------
Unable to sleep, I've had a little time to look at this now...
The failure cases are the three xsl:template entries in the stylesheet at
line 42 onward.
The first of these reads :
<xsl:template match="graphiccontainer[preceding-sibling::*[1][name()='graphiccontainer'] and (following-sibling::*[1][name()!='graphiccontainer'] or position()=last()) ]" />
I'm going well out of my depth here, but this seems to be saying :
Select a node named graphiccontainer which :
the first of all the preceeding sibling nodes is named graphiccontainer
and
the first of all the following sibling nodes is not named graphiccontainer
or
this is the last of the nodes
It is this last clause that is failing; position() doesn't seem to have
a value (proximityPosition is <0).
As I understand it, and reading the output of "testxpath -tree" on that
expression is part of how I've tried to approach this, the expression is
graphiccontainer[<clause> and (<clause> or position() = last())]. This would
mean that position() (and last()) should be within the context of
graphiccontainer[].
A simplified test case is enclosed.
I'm not sure if I've gone about investigating this the right way, but...
it looks like there's something wrong to me.
The test case is attached. I've tried to demonstrate that it depends on
which side of the "and" the "preceding-sibling::*[name()...]" is placed
determines whether the context position is valid or not. In addition, I've
included a couple of examples to show that position() works correctly
when used on its own and in conjunction with last().
Test case produces:
--8<--------
*xsltproc -native eg/xsl eg/xml
Error Invalid context position
xmlXPathCompiledEval: evaluation failed
Error Invalid context position
xmlXPathCompiledEval: evaluation failed
Error Invalid context position
xmlXPathCompiledEval: evaluation failed
<?xml version="1.0"?>
three
'Two' match.
*
--8<--------
I would expect to see output of:
--8<--------
<?xml version="1.0"?>
three
'Two' match.
three, the third one
'Four' match.
The last three.
--8<--------
I hope this makes sense to someone. I don't think that the preceding-sibling
test should have this side effect.
--
Gerph {djf0-.3w6e2w2.226,6q6w2q2,2.3,2m4}
URL: http://www.movspclr.co.uk/
... Eyes to the heavens, screaming at the sky;
Trying to send you messages, but choking on goodbye.
<?xml version="1.0" encoding="UTF-8"?>
<one>
<three />
<two />
<three />
<four />
<three />
<three />
<three />
</one>
eg.xsl
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]