Re: [xsl] Deleting a node depending on contents of a grandfather attribute and a child node

Subject: Re: [xsl] Deleting a node depending on contents of a grandfather attribute and a child node
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Wed, 30 Jul 2003 22:47:59 +0200
John Reid wrote:
i have tried a number of approaches but with various but not correct
results. I want to delete the absent node (and everything below it)
where $vardate = from and @pword $varpword.
...
<xsl:variable name="pword" select="ancestor::@pword"/>
Wont select anything, ever. Try
     <xsl:variable name="pword" select="ancestor::player[1]/@pword"/>
or if the player node is always the grandfather
     <xsl:variable name="pword" select="../../@pword"/>

    <xsl:copy>
      <xsl:apply-templates select="@*|node()[not($date1 = $vardate and
$pword = $varpword)]"/>
  </xsl:copy>

This does not quite match your problem description ("I want to delete the absent node"). The following template <xsl:template match="absent[ancestor::player/@pword=$varpword and from=$vardate]"/> will make processing the nodes in questions a no-op (iow kill it), other absent nodes are copied through by the other template.

J.Pietschmann



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


Current Thread