RE: [xsl] Deleting following sibling element

Subject: RE: [xsl] Deleting following sibling element
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx (by way of B. Tommie Usdin)
Date: Thu, 18 Jan 2001 18:26:10 -0500
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: [xsl] Deleting following sibling element
Date: Wed, 17 Jan 2001 09:28:16 -0000
Message-ID: <000501c08068$b2fdb760$0100007f@mhkhome>
MIME-Version: 1.0
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2910.0)
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
In-Reply-To: <a0500190bb68a9e7f363e@[]>
Importance: Normal

 Does anybody knows how can I delete an element that is the next
 following-sibling of the context node?

XSLT's model is one of selectively copying data from the source to the result, so it's not clear what you mean by "delete". The node won't be copied unless you ask for it to be copied, and if you don't want it to appear in the output then you must find the code that was copying it and change it.

For example: [XML] <a href="anything">link</a><br/>

 <xsl:template match="//a[name(following-sibling::*[1])='br']">



 [The XML Output should be]
 <a href="anything">link</a>

If you want to not-copy a <br> that is preceded by an <a>, write:

<xsl:template match="br[preceding-sibling::*[1][self::a]"/>

Alternatively, ensure that your stylesheet doesn't do an apply-templates on
this element in the first place.

Mike Kay

XSL-List info and archive:

Current Thread