> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> version="1.0">
>
>            <xsl:output method="xml"/>
>            <xsl:strip-space elements="*"/>
>            <xsl:preserve-space elements="xhtml:*"
> xmlns:xhtml="http://www.w3.org/1999/xhtml"/>
>
>            <xsl:template match="*">
>                        <xsl:copy>
>                                    <xsl:for-each select="@*">
>                                                <xsl:copy-of select="."/>
>                                    </xsl:for-each>
>                                    <xsl:apply-templates/>
>                        </xsl:copy>
>            </xsl:template>
> </xsl:stylesheet>
>
> You would expect to get effectively that same stylesheet back out,
however
> what actually comes out is the same stylesheet minux the xmlns:xhtml
> declaration which then causes errors when attempting to use it as a
> stylesheet (except with XSLTC which seems to ignore xsl:preserve-space).
>
> If I change the template to be just:
>
> <xsl:template match="*">
>            <xsl:copy-of select="."/>
> </xsl:template>
>
> the xmlns:xhtml declaration is preserved.  I would have thought the two
> constructs were equivalent though.

They are not equivalent.  This is a generic XSLT question, so a better
forum for it would be the Mulberry XSL list.  However, a few pointers:

   1. Namespace nodes are not attributes in the XPath data model:

      http://www.w3.org/TR/xpath#data-model

   2. You should take a look at the copy instruction in XSLT for more
   information.  There is even an example of the canonical identity
   transformation stylesheet:

      http://www.w3.org/TR/xslt#copying

Dave

Reply via email to