Subject: Re: [xsl] Re: XPath as a stand-alone programming language From: Liam R E Quin <liam@xxxxxx> Date: Wed, 24 Oct 2012 10:58:56 -0400 |
On Wed, 2012-10-24 at 14:29 +0000, Costello, Roger L. wrote: > Is it possible to have an XPath 3.0 program that runs independent of XSLT and Query? Yes. However, XPath still assumes a host language. For example, you can't bind a prefix to a namespace inside XPath. More importantly, many things people want to do with XPath are actually not within XPath's remit - for example, I often hear "how do I use XPath to return an element without any of its children" to which the usual answer is, "XPath returns pointers into a document, so you can't do that. If you want to construct a new element that's a copy of an existing one but without children, use XQuery instead." There are several command-line utilities for linux at least that evaluate an XPath expression against an XML document and return the result as serialized XML. Most of them are based on XPath 1.0, though; the XPath 2 or 3 command-line tools I know of are all XQuery implementations in practice. Which is fine by me as it means some of them are massively faster - e.g. running against an index. One could write a stand-alone XPath implementation that ran against an index, at least in principle, but the only ones I know of are actually embedded in other systems such as databases, and tend to be pretty awful (e.g. not supporting namespaces, so the element name includes the prefix and colon, or half-supporting namespaces so there's no way to bind a prefix and no local-name() function, or supporting an undocumented mixture of Xpath 1 and 2 features...). The situation seems a lot better with XQuery than with XPath, I think largely because of developer and user motivation. Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org freenode/#xml Co-author, 5th edition, "Beginning XML", Wrox, Summer 2012
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Re: XPath as a stand-alon, Andrew Welch | Thread | [xsl] Re: XPath as a stand-alone pr, Costello, Roger L. |
Re: [xsl] Re: XPath as a stand-alon, Вячеслав Седов | Date | Re: [xsl] Re: XPath as a stand-alon, Liam R E Quin |
Month |