Re: [xsl] Convert text nodes to a single string

Subject: Re: [xsl] Convert text nodes to a single string
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 9 Mar 2022 14:33:13 -0000
On Wed, Mar 09, 2022 at 01:58:37PM -0000, rick@xxxxxxxxxxxxxx scripsit:
> I just want this: "This has text.b

Invert it:

elementName[normalize-space()][matches(.,'\P{Zs}')]

and that element has a string property value where some characters
aren't XML whitespace (S ::= (#x20 | #x9 | #xD | #xA)+ so not space,
tab, carriage return, or line feed) AND that string property value has
at least one character that is NOT a member of Unicode character
category "Separators, spaces" so you won't pass through an element
containing one non-breaking space or one thin space or something. (You
will pass through a single period or a single colon or a single comma,
etc.)

If you're sure there are no fancy spaces in the input you only need the
normalize-space() predicate but I've had unfortunate experiences with
document content often enough to prefer both checks.

-- 
Graydon Saunders  | graydonish@xxxxxxxxx
CC&s oferC)ode, C0isses swC! mC&g.
-- Deor  ("That passed, so may this.")

Current Thread