[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] XPATH problem with namespace


Subject: RE: [xsl] XPATH problem with namespace
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 7 Oct 2004 13:07:25 +0100

> Apologies for the XSLT 2.0 newbie question but why does the 
> XSLT author 
> have to deal with two default namespaces in the same 
> document? At first 
> glance, it seems that making XPath aware of the XSLT 
> document's default 
> namespace is a simpler solution.
> 

That's the solution XQuery went for, but it means that if your input file
uses the null namespace and your output file doesn't, then you need to
prefix all your element names in output element constructors, and also if
the output is XHTML then you are likely to end up with prefixes in the
serialized result, which will violate the XHTML DTD and not work in legacy
browsers. Equally, if the output uses the null namespace and the input
doesn't, as in many XML->HTML transformations, you'll be back with having to
prefix all the names in path expressions.

Also, of course, 2.0 has to be backwards compatible with 1.0: but the above
explains why 1.0 decided not to use the default namespace for names in path
expressions.

Michael Kay


Current Thread
Keywords