Hi Garvin,
Templates for attributes are not called by default. Make sure you do
<xsl:apply-templates select="@*" /> or <xsl:apply-templates select="@*|node()"
/> from 'outside' the template. An <xsl:apply-templates /> actually means
<xsl:apply-templates select="node()" />..
Kind regards,
Geert
Drs. G.P.H. Josten
Consultant
http://www.daidalos.nl/
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
http://www.daidalos.nl/
KvK 27164984
De informatie - verzonden in of met dit emailbericht - is afkomstig van
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit
bericht kunnen geen rechten worden ontleend.
From: Garvin Riensche [mailto:g(_dot_)riensche(_at_)gmx(_dot_)net]
Sent: dinsdag 24 maart 2009 23:14
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] copy attribute question
Hello,
I am wondering why the context seems to be different in the
following templates because I thought the output would be the same.
Input:
<a id="1"/>
Template 1:
<xsl:template match="a/@*">
<aa>
<xsl:copy/>
</aa>
</xsl:template>
Template 2:
<xsl:template match="a">
<xsl:for-each select="@*">
<aa>
<xsl:copy/>
</aa>
</xsl:for-each>
</xsl:template>
Template 1 doesn't produce any output and template 2 outputs:
<aa id="1"/>
Why doesn't Template 1 copy the attribute node to element
<aa> like template 2?
regards,
Garvin
--~------------------------------------------------------------------
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>
--~--