[xsl] BOUNCE xsl-list@lists.mulberrytech.com: Admin request of type /\bremove\b/i at line 3

Subject: [xsl] BOUNCE xsl-list@lists.mulberrytech.com: 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 2001
Received: from bravo.whitburn.xcalibre.co.uk (mail@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx [])
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 [] (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@[]>
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

You can match text() whose immediately following sibling is a foo element using the match pattern:


Put that in an empty template, and it will ignore all those text

<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:

          [self::foo or self::bar or self::baz]]

So you can get rid of text for all these elements using just one

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.

    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 Tennison

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

Current Thread