[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Unwanted Prefixes in Output


Subject: [xsl] Unwanted Prefixes in Output
From: Alan <alan-xsl-list@xxxxxxxxx>
Date: Wed, 21 Sep 2005 04:24:29 -0400

    Probably common problem with namespace emissions. Tried to cut
    it down to the basics.

<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:atom="http://www.w3.org/2005/Atom">
    version="2.0">
    
    <xsl:template match="node()" mode="copy-entry"

    <xsl:template match="atom:entry">
        <atom:entry>
            <xsl:apply-templates
                select="document('file://saved-entry.xml')/atom:entry/node()"
                mode="copy-entry"/>
        </atom:entry>
    </xsl:template>

    <xsl:template match="/">
        <xsl:apply-templates select="atom:entry"/>
    </xsl:template>

</xsl:stylesheet>

Input:
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"/>

saved-entry.xml:
<atom:entry
    xmlns:foo="tag:agtrz.com,2005:foo"
    xmlns:atom="http://www.w3.org/2005/Atom">
    <atom:updated>2005-09-20T10:23:32Z</atom:updated>
    <foo:bar>fubar</foo:bar>
</atom:entry>

Output:
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
    <atom:updated xmlns:foo="tag:agtrz.com,2005:foo">2005-09-20T10:23:32Z</atom:updated>
    <foo:bar xmlns:foo="tag:agtrz.com,2005:foo">fubar</foo:bar>
</atom:entry>


I'd like to omit "xmlns:foo" namespace declaration where it will not
be referenced, like under atom:updated.

Cheers.

--
Alan Gutierrez - alan@xxxxxxxxx
    - http://engrm.com/blogometer/index.html
    - http://engrm.com/blogometer/rss.2.0.xml


Current Thread