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

Re: [xsl] Using copy to change a node, whilst retaining the attributes


Subject: Re: [xsl] Using copy to change a node, whilst retaining the attributes
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 5 Aug 2003 09:47:47 +0100


> Tried the below but this does not copy across the attributes. T

that's because you removed   the <xsl:copy-of select="@*"/> line
that were there before. xsl:copy just generates an element node
with the name of the current element you need to copy all attributes and
children if you need them copied.

So you could just add them but...

<xsl:template match="player/dates/yes">
<xsl:copy>
<xsl:choose>
 <xsl:when test="ancestor::player/@pword=$pmkey">

there's not really a lot of point in going down and then coming back
with ancester to test, you may as well test on the way down..

You have two templates like this:
<xsl:template match="player/dates/yes/@ID">
but nowhere are you applying templates to attribute nodes so these
will never activate. You don't want to apply templates to attributes
anyway, you want to copy them as above.


David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread