Subject: Re: Re: Can one _generate_ namespace nodes?
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Mon, 24 Feb 2003 21:18:32 +0100
|
"Joseph Kesselman" <keshlam@xxxxxxxxxx> wrote in message
news:OF61D39BC9.77924166-ON85256CD7.00611483-85256CD7.0062E761@xxxxxxxxxxxxx
> Yes, generating the <xsl:stylesheet> explicitly as <newxsl:stylesheet>
> rather than using <xsl:copy> would result in newxsl: being declared at the
> root.
>
> But then any elements -- or XPaths -- copied from the source stylesheet
> would have the reverse problem; they'd still be using the xsl: prefix and
> would need to declare *that* prefix.
What about the following:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:newxsl="http://dymmy/Transform"
>
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:namespace-alias stylesheet-prefix="newxsl"
result-prefix="xsl"/>
<xsl:template match="/">
<newxsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<newxsl:text>foo</newxsl:text>
</newxsl:stylesheet>
</xsl:template>
</xsl:stylesheet>
The "newxsl" prefix will be bound to the XSLT namespace and the serializer
will generate the necessary namespace definition. In addition to this, a
definition of the XSLT namespace bound to the prefix "xsl" is also present
in the newxsl:stylesheet.
The result will be:
<newxsl:stylesheet xmlns:newxsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<newxsl:text>foo</newxsl:text>
</newxsl:stylesheet>
Therefore, any XPath expressions containing the "xsl" prefix will be
evaluated correctly. In the same way, any other necessary prefixes can be
specified on the newxsl:stylesheet element.
Is there an example, which is still problematic?
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|