|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] XHTML with embedded XQuery: how to deal with the DOCTYPE declaration? How to deal with the default XHTML namespaces?Michael Kay mike at saxonica.comSat Mar 27 16:51:19 PST 2010
> > I am creating an XHTML document and embedding XQuery in it: > > QUESTION #1 > > When I execute the XHTML document (containing XQuery) I get > an error message regarding the DOCTYPE declaration: XQuery syntax is a bit like XML, but it isn't real XML, don't imagine that anything that's OK in XML is OK in XQuery. > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> Yes, an unfortunate bit of design. Because so many people hit problems with the XPath 1.0 rule that "no prefix means no namespace", XQuery designers thought it would be better to have the rule "no prefix means the default namespace". Unfortunately this causes problems if the default namespace for the output document is different from the default namespace for the input document. XSLT 2.0 solves this by allowing different defaults for the input and the output (the xpath-default-namespace attribute), but the XQuery designers thought this was too much complexity. > > Neither approach is very attractive. Is there a better approach? No. XQuery 1.1 will allow you to use URIs wherever you can use prefixes, so you can write //"":planet. (This hasn't yet made it into the published working draft.) Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






