|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] AW: Deleting a node depending on contents of a grandfa
Hi, true, you cannot use a variable in the match pattern. So you have to do either: <xsl:template match="absent"> <xsl:if test="not(from = $vardate and ancestor::player/@pword = $varpword)"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:if> </xsl:template> or <xsl:template match="absentia"> <xsl:copy> <xsl:apply-templates select="@*|node()[not(from = $vardate and ancestor::player@pword = $varpword)]"/> </xsl:copy> </xsl:template> Regards, Markus __________________________ Markus Abt Comet Computer GmbH http://www.comet.de ---------- Von: John Reid Gesendet: Mittwoch, 30. Juli 2003 23:50 An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Betreff: RE: Deleting a node depending on contents of a grandfather attribute and a child node 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 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






