Re: [xsl] exclude result prefixes doesn't stop prefix from showing up.

Subject: Re: [xsl] exclude result prefixes doesn't stop prefix from showing up.
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 22 Aug 2003 19:51:28 +0100


> I'm working with Saxon 6.5.3 and Xerces 2.4. My experiences suggest that 
> if the source document contains a default namespace then you have to map 
> the namespace to an alternate prefix (ddi: in my example) otherwise the 
> templates "match and select" statements do not work), in other words its 
> impossible to match elements in the default xmlns namespace without 
> mapping that namespace to a different prefix. I see this done often in 
> the FAQ, see for example:
> 
> http://www.dpawson.co.uk/xsl/sect2/N5536.html#d5145e970
> 
> I find this counter-intuitive. It seems that if the default namespace is 
> just a namespace with the prefix "". then if I try to match elements in 
> that namespace, then they just shouldn't have a prefix. In other words:
> 

The behaviour you describe has _nothing_ to do with whether namespaces
in the source use or don't use a prefix. Unprefixed names in Xpath
always refer to elements in no-namespace, prefixed names refer to
elements in a namespace, so to access a namespaced element you always
have to use some prefix. You don't have to use a prefix related to the
prefixes that may be used in the source.

an Xpath of /foo doesn't match an element foo if the default namespace
is non-null, this is just the same as an xpath of /x:foo doesn't match
an element x:foo if the x prefix is bound to a different namespace
in the source.


David

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread