Hi all,
My apologies if I'm missing some obvious documentation on this, my brain
seems to work a different way to the xml.apache.org site and I have trouble
finding anything.

I'm trying to use XSLTC to run an XSLT over another XSLT.  In XSLT there are
often times when a prefix is used as part of an attribute value and it must
be defined correctly.  For example:

<xsl:preserve-space elements="xhtml:*"
xmlns:xhtml="http://www.w3.org/1999/xhtml"/>

So for a somewhat contrived (but simple) example of the problem, take the
following stylesheet and run it over itself:

<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.

I'm using XSLTC built from XAlan 2.5.1 on Java 1.3.1 on Mac OS X.

Any pointers to what I'm doing wrong and/or how to fix things would be
greatly appreciated.

Thanks in advance,

Adrian Sutton, Software Engineer
Ephox Corporation
www.ephox.com

Reply via email to