OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Concerned about the increasing reliance on XPath

On 9 May 2011 18:52, Philip Fearon <pgfearo@googlemail.com> wrote:
> Yes, it seems each vendor has adopted their own 'harness' for setting
> the XPath evaluation context so that saved XPaths are portable.

Yes, but this highlights my issue; they are portable *within instances of
that implementation and not (as much as we'd like) between implementations*

> SketchPath's approach is to create grouped sets of XPath expressions
> that are saved in simple XML files so they can be reused easily as a
> resource in other applications.
> (These same XML files are also used to set parameters and processor
> settings for an XSLT test tool).
> As well as the XPath itself, additional metadata is stored for each expression:
> 1. A name for the expression - other expressions can use this name to
> reuse the expression as a variable
> 2. An XPath identifying the context node for evaluation
> 3. A descriptive comment

Yes, my interest has been in Tamelizer (GoogleCode project) and this
does the same

> Each XML file includes a set of namespace bindings to be used for
> expression evaluation - (these are actually just XPath expressions in
> a special 'namespaces' group with names corresponding to the namespace
> prefix)

Tamelizer uses TAML-X, an XPath profile of TAML
(OASIS-open.org, potential standard in progress)
which puts namespace bindings in each TAML-X
file. I didn't realise it but it might be that more portability
would come by putting the bindings into each TAML
test assertion (as I recently suggested for Schematron
too) so that they can be copied and pasted between

I do notice though that some standards are appearing
which express test assertions in a spec using XPath
and I wonder if they have thought about these details
like namespace bindings and making explicit any defaults.

> - A sample XML fof the grouped XPath expressions and their metadata is
> shown below
> <?xml version="1.0" encoding="UTF-8"?>
> <cwb:expressions xmlns:cwb="http://www.qutoric.com/2010/XPathCollection";>
> <cwb:xsl-param group="" source=""/>
> <cwb:namespace-declarations>
> <cwb:expression name="spec">
> <cwb:main>'http://expath.org/ns/xmlspec'</cwb:main>
> <cwb:comment>Created: 09/05/2011 18:18:45</cwb:comment>
> </cwb:expression>
> </cwb:namespace-declarations>
> <cwb:xpath>
> <cwb:global>
> <cwb:expression name="code-1">
> <cwb:main>p/code</cwb:main>
> <cwb:context>/spec/body/div1[3]/div2[2]</cwb:context>
> <cwb:comment>Created: 09/05/2011 18:24:16</cwb:comment>
> </cwb:expression>
> </cwb:global>
> <cwb:local>
> <cwb:group name="alpha">
> <cwb:expression name="header-1">
> <cwb:main>/spec/header</cwb:main>
> <cwb:comment>Created: 09/05/2011 18:16:13</cwb:comment>
> </cwb:expression>
> </cwb:group>
> <cwb:group name="beta">
> <cwb:expression name="head-1">
> <cwb:main>/spec/body/div1[1]/head</cwb:main>
> <cwb:comment>Created: 09/05/2011 18:17:44</cwb:comment>
> </cwb:expression>
> <cwb:expression name="head-2">
> <cwb:main>/spec/body/div1[1]/head</cwb:main>
> <cwb:comment>Created: 09/05/2011 18:18:00</cwb:comment>
> </cwb:expression>
> <cwb:expression name="Name1">
> <cwb:main>count(spec/body/div1/div2)</cwb:main>
> <cwb:comment>Created: 09/05/2011 18:19:28</cwb:comment>
> </cwb:expression>
> </cwb:group>
> </cwb:local>
> </cwb:xpath>
> <cwb:recyclebin/>
> </cwb:expressions>

Yes, I like that.

Maybe there would be more portability if your XML language could
also allow every group to inlude the bindings though, like this:

             <cwb:group name="alpha">
                <cwb:expression name="header-1">
                        <cwb:expression name="spec">
                            <cwb:comment>Created: 09/05/2011
                    <cwb:comment>Created: 09/05/2011 18:16:13</cwb:comment>

See also my own XPath based test assertions for the Universal Business
Language using the TAML-X profile

and earlier ones here for a previous version of TAML

Maybe here too each test assertion should optionally allow
the namespaces to be declared for it locally.


Stephen D Green

> -----------
> Phil Fearon
> http://qutoric.com
> On Mon, May 9, 2011 at 5:13 PM, G. Ken Holman
> <gkholman@cranesoftwrights.com> wrote:
>> At 2011-05-09 16:49 +0100, Stephen D Green wrote:
>>> I think we tend to hope that XPath expressions can be
>>> written such that they are immune from such implementation
>>> specifics
>> XPath cannot function in a vacuum.
> _______________________________________________________________________
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS