Re: [xsl] Getting all the text of an element, except for one type

Subject: Re: [xsl] Getting all the text of an element, except for one type
From: "Imsieke, Gerrit, le-tex gerrit.imsieke@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 9 Feb 2024 14:10:40 -0000
Hi Rick,

Martin's and Syd's approaches using detailed template matches are preferable, but let me just point out what you were missing.

Let me paraphrase the expression slightly:

title/descendant-or-self::* except ./data

where . is the section element that the template matches.

But section has no data children.

You could phrase it differently, yet slightly inefficiently:

title/descendant-or-self::* except title/descendant::data

or use a predicate:

title/descendant-or-self::*[not(self::data)]

But still you'd get duplicate strings: The string value of title, plus the string value of the contained ph element.

So this won't lead to anything useful, and I, too, recommend an idiomatic template matching approach.

Gerrit

On 09.02.2024 14:57, rick@xxxxxxxxxxxxxx wrote:
B B B B <xsl:template match="section">

B B B B B B B <entry><xsl:value-of select="title/descendant-or-self::* except data"/></entry>

B B B </xsl:template>


-- Gerrit Imsieke GeschC$ftsfC<hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

GeschC$ftsfC<hrer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt

Current Thread