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

Generating xhtml from xml in no namespace

Michael Kay mike at saxonica.com
Wed Dec 17 11:50:10 PST 2008


  Generating xhtml from xml in no namespace
> 
> This is surely a faq, but I'm interested in what people think 
> is the right approach for this...
> 
> The input is in no namespace, the required output is unprefixed xhtml:
> 
> <html xmlns="http://www.w3.org/1999/xhtml">
>   ....
>   <body>
>   {
>      for $x in collection(...)/path/to/node
> 
> For some reason the default namespace on the html element 
> affects the xpath - which is different to xslt and a little 
> odd to me...
> 
> Is there something like xpath-default-namespace so I can 
> clear the default namespace for the xpaths?

No, unfortunately not. I tried to get something like this in, but the
general tendency of the WG was resistance to making namespaces even more
complicated than they were already.

If you want the output to be in an unprefixed namespace, but the input is in
no namespace, then the only ways I know to achieve this are either

(a) to use computed element constructors to create all the output elements,
or

(b) to put all the path expressions into functions, rather than having them
nested within element constructors

I think it would have been better to have had two completely separate static
namespace contexts, one used for path expressions and one for constructed
elements, and for namespace declarations on constructed elements to affect
only the latter.

Michael Kay
http://www.saxonica.com/



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