[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
by biglist.com (8.8.8/8.8.5/BL-2) with ESMTP id EAA13550
for <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>; Thu, 11 Jan 2001 04:51:04 -0500 (EST)
Received: from [194.88.81.28] (helo=TIFERET)
by bravo.whitburn.xcalibre.co.uk with esmtp (Exim 3.15 #1)
id 14GeAs-00045v-00; Thu, 11 Jan 2001 09:37:39 +0000
Date: Thu, 11 Jan 2001 09:46:18 +0000
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
X-Mailer: The Bat! (v1.49) Business
Reply-To: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Organization: Jeni Tennison Consulting Ltd
X-Priority: 3 (Normal)
Message-ID: <462488197.20010111094618@xxxxxxxxxxxxxxxx>
To: "Devlin, Kurt" <Kurt.Devlin@xxxxxxxxxxxxx>
CC: xsl-list <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [xsl] BOUNCE xsl-list@xxxxxxxxxxxxxxxxxxxxxx: Admin request of type /\bremove\b/i at line 1
In-reply-To: <a05001908b682f40144ff@[63\.48\.105\.105]>
References: <a05001908b682f40144ff@[63.48.105.105]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi Kurt,
text()[following-sibling::node()[1][self::foo]]
You say:
I hope that helps,
Jeni
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
[xsl] BOUNCE xsl-list@lists.mulberrytech.com: Admin request of type /\bremove\b/i at line 3
Subject: [xsl] BOUNCE xsl-list@...: Admin request of type /\bremove\b/i at line 3 From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx (by way of B. Tommie Usdin) Date: Thu, 11 Jan 2001 09:29:07 -0500 |
From mail@xxxxxxxxxxxxxxxx Thu Jan 11 04:51:04 2001Received: from bravo.whitburn.xcalibre.co.uk (mail@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx [194.201.48.11])
by biglist.com (8.8.8/8.8.5/BL-2) with ESMTP id EAA13550
for <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>; Thu, 11 Jan 2001 04:51:04 -0500 (EST)
Received: from [194.88.81.28] (helo=TIFERET)
by bravo.whitburn.xcalibre.co.uk with esmtp (Exim 3.15 #1)
id 14GeAs-00045v-00; Thu, 11 Jan 2001 09:37:39 +0000
Date: Thu, 11 Jan 2001 09:46:18 +0000
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
X-Mailer: The Bat! (v1.49) Business
Reply-To: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Organization: Jeni Tennison Consulting Ltd
X-Priority: 3 (Normal)
Message-ID: <462488197.20010111094618@xxxxxxxxxxxxxxxx>
To: "Devlin, Kurt" <Kurt.Devlin@xxxxxxxxxxxxx>
CC: xsl-list <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [xsl] BOUNCE xsl-list@xxxxxxxxxxxxxxxxxxxxxx: Admin request of type /\bremove\b/i at line 1
In-reply-To: <a05001908b682f40144ff@[63\.48\.105\.105]>
References: <a05001908b682f40144ff@[63.48.105.105]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi Kurt,
I need to remove some PCDATA prior to a specified element. I am rendering my XML to HTML. In the main section I want all the information shown. In the table of references that gets generated at the end of the document, I want to strip certain elements and the PCDATA that appears directly before that element.
Currently, I have templates that ignore the elements that I'm not interested, but I'm not sure how to get to the PCDATA before this element.
You can match text() whose immediately following sibling is a foo element using the match pattern:
text()[following-sibling::node()[1][self::foo]]
Put that in an empty template, and it will ignore all those text elements:
<xsl:template match="text()[following-sibling::node()[1][self::foo]]" mode="ToC" />
If you have more elements whose immediately preceding text you want to ignore, then you can add them to the predicate:
text()[following-sibling::node()[1] [self::foo or self::bar or self::baz]]
So you can get rid of text for all these elements using just one template.
You say:
I have created a simple example of what I want to do below. In this example it would be simple to just look at the elements that I do want, but in my real project there are too many elements that I do want. I really only want to add a couple of templates to handle ignoring the element and its preceding PCDATA.
If you want to select all elements aside from a chosen few, you can use the same kind of syntax, using the self:: axis. For example, the following selects all elements that aren't foo, bar or baz elements.
<xsl:apply-templates select="*[not(self::foo or self::bar or self::baz)]" mode="ToC" />
This is slightly better (I think) than applying templates to all the elements and having empty templates that match those you don't want because it narrows down the nodes that the templates are applied to early on.
I hope that helps,
Jeni
--- Jeni Tennison http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] BOUNCE xsl-list@..., by way of B. Tommie | Thread | [xsl] BOUNCE xsl-list@..., by way of B. Tommie |
[xsl] BOUNCE xsl-list@..., by way of B. Tommie | Date | [xsl] BOUNCE xsl-list@..., by way of B. Tommie |
Month |
Keywords