xsl-list
[Top] [All Lists]

Re: list of actual attributes?

2005-04-08 02:59:35
http://www.dpawson.co.uk/xsl/sect2/identity.html

Cheers,

Dimitre Novatchev

On Apr 8, 2005 7:44 PM, Per Jessen <per(_at_)computer(_dot_)org> wrote:
I'm trying to process some XML and essentially create a copy of my 
input-file, with
the exception of changing/replacing a few elements and a few attributes.

I use separate templates for those elements and attributes I need to change 
and for
the rest I use the following:

<xsl:template match="*">
        <xsl:element name="{name()}">
        <xsl:for-each select="@*">
        <xsl:attribute name="{name()}">
        <xsl:apply-templates select="."/>
        </xsl:attribute>
        </xsl:for-each>
        <xsl:apply-templates/>
        </xsl:element>
</xsl:template>

I could have used <xsl:copy> instead of <xsl:element name="{name()}">, but I 
don't see what I'd
gain.  (perhaps someone can explain?) 
Also, AFAICT, using <xsl:copy-of> would not work when I need to apply 
separate templates to
individual children?

Anyway, the problem I'm experiencing is - the list of attributes that I get 
using '@*' seems to
also include the attributes with default values from the DTD.  How do I get 
the list of
actual attributes as used in the source document?

I'm using xalanc 1.8 if that's important.

/Per Jessen, Zürich

--
http://www.spamchek.co.uk/freetrial - anti-spam and anti-virus services in 30 
minutes.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>