xsl-list
[Top] [All Lists]

RE: [xsl] xsl:namespace

2009-02-20 12:49:32
In the case of QName-valued attributes (of which xsi:type is a well-known
example), xsl:namespace is needed if (A) the namespace prefix or URI is
decided dynamically, or (B) if the containing element is constructed using
xsl:element. But there's nothing wrong with using it in other cases too.

Another use case for xsl:namespace is to promote a namespace declaration to
the root element of a document to avoid the clutter caused when it appears
on hundreds of child elements. Again, xsl:namespace is needed only if the
root element is created using xsl:element or if the namespace URI or prefix
is computed.

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: Jesper Tverskov [mailto:jesper(_dot_)tverskov(_at_)gmail(_dot_)com] 
Sent: 20 February 2009 17:33
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] xsl:namespace

I use the xsi:type example because that is the one we have in 
the spec, http://www.w3.org/TR/xslt20/#element-namespace, and 
the one Michael Kay is using in "XSLT 2,0 and XPath 2.0", 4th 
Edition, page 392. But the problem with the examples in the 
spec and MK are, that xsl:namespace is not really needed. The 
spec admits that an xsl:element example would have been more 
appropriate.

So I kept the literal not so good example of spec and MK as 
alternative 2 but I removed xsl:namespace. Then I added an 
example with xsl:element, alternative 1,  and I added a 
dynamic one, alternative 3.

But the two proposals of Florent and Vladimir are basically 
the literal example one more time where xsl:namespace is not 
needed unless in a dynamic solution as in my alternative 3. 
We could make Vladimir's dynamic but it will not make it less 
artificial or confusing than my own example. Instead of the 
xsi namespace we will get some other namespace.

So wee still need some good examples of why xsl:namespace can 
be necessary. I have provided a dynamic one where it is 
necessary, and one using xsl:element, where xsl:namespace is 
also necessary if xsl:element must be used (we might e.g. 
need to compute the name of the element).


Cheers,
Jesper Tverskov

http://www.xmlkurser.dk
http://www.xmlplease.com

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



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

<Prev in Thread] Current Thread [Next in Thread>