Re: [xml] Legitimate xpath expressions in XSLT

Date view Thread view Subject view Author view

From: ross.alexander@uk.neceur.com
Date: Mon Feb 19 2001 - 06:45:19 EST


The extra <?xml version="1.0"?> is definitely a cut and paste error.

Many thanks for the patch. Excelent work on libxslt by the way. Many
thanks
all round.

Ross

Daniel Veillard <Daniel.Veillard@imag.fr>
Sent by: xml-request@rufus.w3.org
19/02/01 09:28
Please respond to xml

 
        To: xml@rpmfind.net
        cc:
        Subject: Re: [xml] Legitimate xpath expressions in XSLT

On Sun, Feb 18, 2001 at 05:13:56PM +0000, ross.alexander@uk.neceur.com
wrote:

  Hi Alexander,

> Which is fine, except that when I use the statement
>
> <xsl:for-each select="*">
> <xsl:value-of select="./@name"/><?xml version="1.0"?>
> <xsl:text> </xsl:text>
> </xsl:for-each>
>
> Error xpath.c:5215: Invalid expression
> *
> ^
> Segmentation fault (core dumped)

  Two things:
    1/ <?xml version="1.0"?> at that place in the document is an
       error, I assume it's just a cut and paste error ...
       (precisely it's an invalid PI form, XML declaration are only
       allowed as the first declaration in the document).
    2/ Yessss it's a bug !
       I can't believe that something so basic escaped to the tests
       for such a long time, thanks a lot for reporting it. Again an
       error in the detection of abbreviated sequences. Patch enclosed
       applying to libxml-2.3.1 !

> Now, before libxslt came out I was using (and still do) use xalanj. Both

> xalanj-1.2.2 and
> xalanj-2.0.0 give the correct? result of listing all the skill names as
> above.

  yes it's correct,

> So, which implementation is correct or is there ambiguity with the XPATH

> spec.

  No ambiguity, if it segfault, it's a problem of the implementation :-)

> Personally I think there is a problem with the spec. In the examples of
> abbrevitated
> location paths * is described as all element children of the context
node
> but in
> more formal syntax I can find no reference for *.
> Should select="*" be identical to select="node()"?

  2.5 states (2nd example):
    http://www.w3.org/TR/xpath#path-abbrev

-------------------
* selects all element children of the context node
-------------------

  For "node()" construct this is an abbreviated version of "child::node()"
i.e. the child axis is the default one.

  Section 2 states (4th example)
    http://www.w3.org/TR/xpath#location-paths

-------------------
child::node() selects all the children of the context node, whatever
their node type
-------------------

  Sounds really clear to me, * selects less nodes than node(), i.e.
it restricts itself to element nodes (dropping text, PIs, comments, ...).

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard@redhat.com  | libxml Gnome XML toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/


----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Feb 19 2001 - 08:44:08 EST