Re: How to get XPath in a XSLT shylesheet
> Yes, I regularly come across root elements like this: > > <foo xmlns="aaa" xmlns:foo="aaa"> > <foo:bar>... > > I think it's because authors don't like (or didn't think it was > possible) to define the prefix on the element that uses the prefix, > eg: That's actually what you get by default from any xslt transform that does a transform from documents in the aaa namespace to itself. You get foo xmlns="aaa" because it's copied from the source, or because you generated an unprefixed element, and you get xmlns:foo="aaa" because the stylesheet needs to declare the namespace with a prefix so it can do xpath queries on the source. (The prefix could be suppressed using exclude-result-prefixes, but not everyone remembers that) > The technique which has won the prize for being most annoying is > defining the default namespace in the DTD as a defaulted attribute... If using a DTD to define (say) xhtml, you need to declare xmlns as an attribute (as it is an attribute at the DTD layer) and it's very tempting to specify that its only allowed value is http://www.w3.org/1999/xhtml but unfortunately #FIXED doesn't just define the legal value, it defaults that value if the attribute is omitted, so I don't think that in DTD there is any way to indicate (other than in comments) the namespace for which the grammar is intended, without defaulting this attribute. (The XHTML+MathML DTD uses a modified version of the XHTML DTD as base, specifically to avoid defaulting the namespace declarations) David
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
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