This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: name space troubles
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Sun, 26 May 2002 16:35:27 +0100
- Subject: RE: [xsl] name space troubles
- Reply-to: xsl-list at lists dot mulberrytech dot com
> I would like to have the resulting style sheet with the
> following openning:
>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
> ="1.0" xmlns="http://www.deio.net/cbamessage">
>
>
> so in the stylesheet which process the XSD I have the following
>
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl
> ="http://www.w3.org/1999/XSL/Transform" xmlns:xsd
> ="http://www.w3.org/2001/XMLSchema"
> xmlns="http://www.deio.net/cbamessage">
>
> ...
>
> <xsl:element name = "xsl:stylesheet">
> <xsl:attribute name = "version">1.0</xsl:attribute>
>
> ...
>
>
> the result is
>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version ="1.0">
>
> ...
> <CancellationReasonContainer
> xmlns="http://www.deio.net/cbamessage">
> ...
>
xsl:element creates an element in the result tree; the only namespace
nodes it creates are (a) any namespaces inherited from ancestor elements
in the result tree (there are none in your case), (b) namespaces
required by the element name and attribute names of the new element.
If you want an additional namespace declaration you can either (a)
create it explicitly after calling xsl:element by using xsl:copy (or, in
XSLT 2.0, xsl:namespace), or (b) not use xsl:element, but use a literal
result element instead.
Note that you can't necessarily control what prefixes are used in the
result document, only the actual namespace URIs.
Michael Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list