[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Fwd: querying attribute?

G. Ken Holman gkholman at CraneSoftwrights.com
Thu Mar 19 07:54:49 PST 2009


 Fwd:  querying attribute?
At 2009-03-18 17:06 -0500, Thomas R. Jones wrote:
>>So it is correct to declare and reference namespace prefixes within 
>>xquery even though they are not "explicitly" done so in source code?

Absolutely ... in fact it is required.  Prefixes are ephemeral and 
should be irrelevant in queries.  They are only a proxy to the URI 
string associated with the prefix.  The data model happens to contain 
the prefixes used, but the name matching is based on the URI string 
and the local part.

Your transform references URI/local-part names using your choice of prefixes.

Your users' XML documents reference URI/local-part names using their 
choices of prefixes.

The URI/local-part names match regardless of the prefixes used in both.

After all, you still want your transform to work even if the users 
change their minds about their use of namespace prefixes or the 
default namespace.

>>I'm guessing the parser is handling this natively. The XML source 
>>is located within an international database and it strips prefix 
>>declarations within the import triggers. :(

This is not a sad thing.  Provided that they have not lost the fully 
qualified names by stripping the URI strings, they can choose to use 
any prefix they want (for elements and attributes) or no prefix (for 
elements).  Your transform doesn't have to change.

I hope this helps.

. . . . . . . . Ken

--
XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:http://x-query.com/mailman/listinfo/talk
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/q/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/q/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal



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-2011 All Rights Reserved.