[xquery-talk] Default namespace best practices?

Michael Rys mrys at microsoft.com
Tue Mar 8 12:06:29 PST 2005


If you are clearly managing your input and output namespaces, I think it
is up to you what you use as a default element namespace (if any). The
main issue you have to be aware of is that it will be applied to both
queries on incoming data if they refer an NCName and on generating
output elements where the new name is an NCName.

Best regards
Michael

> -----Original Message-----
> From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com] On
Behalf
> Of David Sewell
> Sent: Tuesday, March 08, 2005 10:59 AM
> To: talk at xquery.com
> Subject: [xquery-talk] Default namespace best practices?
> 
> A question for people using XQuery to produce XHTML output directly.
> Do you declare the XHTML namespace as your query default, i.e.
> 
>   declare default element namespace "http://www.w3.org/1999/xhtml";
> 
> or do you instead use as the default namespace the primary namespace
> used by your data?
> 
> I realize that from one point of view it's an arbitrary decision, but
> the choice has implications for readability and maintainability of
code
> in some cases. Also, if the XML documents you're working with are in
no
> namespace, declaring the XHTML namespace as the default means that you
> have no way to address them in path expressions inside element
> constructors without using wildcard namespace prefixes:
> 
>    <p>{ data($mydoc/*:text/*:body/*:title) }</p>
> 
> Any thoughts on pros and cons will be appreciated,
> 
> David
> 
> --
> David Sewell, Editorial and Technical Manager
> Electronic Imprint, The University of Virginia Press
> PO Box 400318, Charlottesville, VA 22904-4318 USA
> Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
> Email: dsewell at virginia.edu   Tel: +1 434 924 9973
> Web: http://www.ei.virginia.edu/
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk



More information about the talk mailing list