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] XPath to XML markup converter?

At 2011-05-07 15:51 -0400, Costello, Roger L. wrote:
> > By "equivalent XML markup" do you mean XQueryX
>Can XQueryX represent any arbitrary XPath expression?

Yes, I believe it can.  If not then there would be a bug in XQueryX.

>I would like a tool that converts any arbitrary XPath expression and 
>the resulting XML markup isn't necessarily an "XQuery".

But it is, because XPath is a strict subset of XQuery, so you can use 
the XQueryX vocabulary for all of XPath.  Below is an example of an 
entire XQuery query made up purely of an XPath expression.  I don't 
have a tool with which to translate this to XQueryX for you ... I'm 
just trying to help point you in a useful direction.

It is a simple example, but it illustrates my point that XPath *is* XQuery.

Wait ... it says it here:

  "XQuery Version 1.0 is an extension of XPath Version 2.0. Any
   expression that is syntactically valid and executes successfully
   in both XPath 2.0 and XQuery 1.0 will return the same result in
   both languages."

... so you don't have to take my word for it.

>For example, I may extract an XPath expression from the new XML 
>Schema 1.1 assert element, and I would like the tool to generate XML 
>markup which expresses the same semantics.

Why reinvent the wheel if XQueryX has all of XPath in its XML vocabulary?

. . . . . . . . . Ken

T:\ftemp>type roger.xml
<?xml version="1.0" encoding="UTF-8"?>
   <p this="yes">This is a para</p>
   <p>This is another para</p>
   <p this="no">This is the last para</p>

T:\ftemp>type roger.xq

T:\ftemp>xquery roger.xq
<?xml version="1.0" encoding="UTF-8"?>
<p this="yes">This is a para</p>
<p>This is another para</p>

Contact us for world-wide XML consulting & instructor-led training
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

[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