xsl-list
[Top] [All Lists]

RE: Deleting a node depending on contents of a grandfather attribute and a child node

2003-07-30 14:50:23
I understood that I could not use variables in a template match
statement such as
<xsl:template match="absent[ancestor::player/@pword=$varpword
    and from=$vardate]"/>
Or am I missing something?
Salud
John
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


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