This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: re: generation of qnames/prefixes in content and value [was xbind:module....]
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] re: generation of qnames/prefixes in content and value [was xbind:module....]
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Mon, 5 Mar 2001 14:25:13 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
> Actually, as far I can tell, it would also prevent the
> generation of any XML
> application that used qualified names in contexts other than tag or
> attribute names.
>
Actually it *is* possible to safely output a QName as an attribute value,
given the statements in the XSLT 1.0 errata about the effect of copying a
namespace node. It's pretty obscure territory though, and you may find that
not all processors get it right.
You can produce a namespace node in the result tree by copying a namespace
node either from a source document or the stylesheet. Normally namespace
nodes are copied when a source element is copied using <xsl:copy> or when a
literal result element in the stylesheet is copied; however one of the
errata makes it clear that if there are no conflicts, you can also copy a
namespace node using <xsl:copy> or <xsl:copy-of>, which means you can inject
a new namespace node into the result by having a secondary source document
<dummy xmlns:ppp="some.namespace.uri"/>
and doing <xsl:copy-of select="document('dummy.xml')/*/namespace::ppp"/>
When a namespace node is present on the result tree, the serializer must
output a namespace declaration for it, and it is not allowed to change
either the prefix or the URI.
This means you can safely use this prefix in the value of a generated
attribute.
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list