Re: [xsl] Namespaces best practice in XML

Subject: Re: [xsl] Namespaces best practice in XML
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 4 Apr 2006 15:28:57 +0100
> at I need this stylesheet to be 
> as accessible to as many people as possible. Having to prefix all source XML 
> elements in the XSLT when that prefix doesn't physically exist in the XML 
> adds a level of complexity that non-namespace-savvy developers might find 
> confusing.

I think people get used to this pretty quickly (if they look at xsl for
very long at all) if in the stylesheet you declare a prefix a: and then
select a:foo that means select foo in that namespace, whatever prefix
(including no prefix at all) is used in the source file. the source file
doesn't have to use the same prefix a:. This is just a general rule: there
is really nothing special about the so called default namespace here.

Although having said that, a lot of people did apparent;y want to use
non-prefixed element names to refer to namespaced elements in XPath so
in XPath2 (and so in XSLT2) you will be able to set the default Xpath
element namespace, and have everything that you want.

> use a version of HTML which doesn't require a namespace declaration 
which of course is _all_ versions of html. Namespaces don't apply to
HTML, only to XHTML (all versions of which do require the elements to be
in a namespace, sadly different namespaces for XHTML 1 and XHTML 2)


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread