xsl-list
[Top] [All Lists]

Re: [xsl] Is it possible to set the default namespace with a dynamically-generated namespace uri?

2010-03-12 18:01:23
On 12/03/2010 23:44, Dimitre Novatchev wrote:
It seems to me that using<xsl:namespace>  it is not possible to
specify a default namespace.


it's possible to use xsl:namespace to produce a namespace node with no name which produces a default namespace declaration in the result tree but xsl:namespace (whether with a Qname or empty string as the name attribute) never changes the namespace of nodes creted, just adds additional nodes.


so in


 <a:b xmlns:a="b">
  <xsl:namespace name="" select="'zzz'"/>
    <c/>
 </a:b>


then (assuming that there wasn't already a default namespace in scope)
xsl:namespace will indeed generate a default namespace binding but it doesn't change the namepsace of a:b 9as that;s already generated with the prefix and namespace b, an dit doesn't affect the namespace of c as pputting a namespace node in the result tree doesn't affect the namespace context in the stylesheet, so you get


<a:b xmlns:a="b" xmlns="zzz"><c xmlns=""/></a:b>

which has xmlns="zzz" but the system adds xmlns="" to preserve the (no)namespace of c.

David




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--