RE: [xsl] Copying and updating selectively

Subject: RE: [xsl] Copying and updating selectively
From: Américo Albuquerque <melinor@xxxxxxx>
Date: Mon, 28 Jul 2003 15:40:48 +0100
Hi

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of John Reid
> Sent: Saturday, July 26, 2003 10:32 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Copying and updating selectively
> 
> 
> Thanx Américo Albuquerque,
> 
> That worked well, and taught me something.
> 
> Another q
> 
> If I was to add another condition that is higher up the tree 
> how/where would I best test it Ie The same template but this 
> time I am asking only to test those players where pword a 
> parameter = @pword. This is really 2 problems for me, I guess 
> I would like to know the best way to pass a parameter to a 
> template as a condition of entry and to also know how to test 
> further up the tree.

You can add any condition as you like. To check for player/@pword just
change this line:
<xsl:apply-templates select="node()[not(self::text())]|text()[not($id &gt;=
$varFrom and $id &lt;= $varTo)]|@*"/>

To this:
<xsl:apply-templates select="node()[not(self::text())]|text()[not($id &gt;=
$varFrom and $id &lt;= $varTo and ancestor::player/@pword =
$varPword)]|@*"/>

The text()[not(condition)] will copy any text() node when not(condition) is
true, so you'll have to set condition=(you conditions to copy text)
In this case these conditions are:

$id greater or iqual to $varFrom
AND
$id smaller or iqual to $varTo
AND
Ancestor::player/@pword iqual to $varPword

We can add any others and wrap them all with a not(...) because you want to
delete those that match

Hope this helps you.

Regards,
Américo Albuquerque

(...)



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


Current Thread