Altova Mailing List Archives


Re: XSLT and namespace resolution

From: "Dimitre Novatchev" <dnovatchev@-----.--->
To: NULL
Date: 10/25/2003 4:25:00 PM
This transformation is not an "identity transform" as it generally creates
an output tree in which the top element node will have a different set of
namespace nodes than the top element node of the input tree.

The original question was not to do such a transformation.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL



"Marrow" <m--a-r-r-o-w@m-a-r-r-o-w--s-o-f-t.com> wrote in message
news:Owm59rumDHA.1072@T......
> Hi Andy,
>
> > How can I ensure that the root element defines all of the namespaces for
> the
> > whole document? Otherwise the XML becomes littered with namespace
> > declarations, as it appears to resolve each namespace as it is
> encountered.
>
> So the purpose of your identity transform is to put all the namespace
> declarations into the root element?
>
> If so, you could try something like...
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet version="1.0"
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
>   <xsl:output method="xml" encoding="iso-8859-1"/>
>
>   <xsl:template match="/*">
>     <xsl:copy>
>       <xsl:copy-of select="//namespace::*"/>
>       <xsl:apply-templates select="@* | node()"/>
>     </xsl:copy>
>   </xsl:template>
>
>   <xsl:template match="*">
>     <xsl:copy>
>       <xsl:apply-templates select="@* | node()"/>
>     </xsl:copy>
>   </xsl:template>
>
>   <xsl:template match="@* | text() | comment() |
processing-instruction()">
>     <xsl:copy/>
>   </xsl:template>
>
> </xsl:stylesheet>
>
>
> Hope this helps
> Marrow
> http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
> http://www.topxml.com/Xselerator
>
>


Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.