XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] 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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS