[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to get XPath in a XSLT shylesheet

  • From: David Carlisle <davidc@n...>
  • To: andrew.j.welch@g...
  • Date: Wed, 10 Jan 2007 14:44:44 GMT

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 
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

(The XHTML+MathML DTD uses a modified version of the XHTML DTD as base,
specifically to avoid defaulting the namespace declarations)


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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