[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XPath 1.0 challenge: select all XML Schema element

Subject: Re: XPath 1.0 challenge: select all XML Schema element declarations with type string
From: "Ihe Onwuka ihe.onwuka@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 19 Jul 2015 20:29:15 -0000
Re:  XPath 1.0 challenge: select all XML Schema element
On Sun, Jul 19, 2015 at 4:26 PM, liam liam@xxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> On 2015-07-19 15:58, Costello, Roger L. costello@xxxxxxxxx wrote:
>
>> Hi Folks,
>>
>> The following XPath expression returns all XML Schema element
>> declarations with @type equal to xs:string:
>>
>>         //xs:element[@type = 'xs:string']
>>
>> However, that XPath assumes the schema file is written with a
>> namespace prefix, like this:
>>
>>         <xs:element name="Test" type="xs:string" />
>>
>
>  But the schema file could have been written like this:
>>
>>         <element name="Test" type="string" />
>>
>
> There are two issues here. The first is matching the element called
> 'element' and your XPath expression will work fine there, assuming you've
> bound the prefix "xs" to the XML Schema namespace URI and that the same
> namespace name is the default namespace for the prefix-less Schema document.
>
> The second issues is matching "string" or xs:string". We know that it's a
> QName and must have zero or one colon, so
>     @type = "string" or substring-after(@type, ":") = "string"
> would work.
>
>
Ahhhhh Good spot on the 2nd issue Liam.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.