Re: [xsl] Flatten a node set into a single string

Subject: Re: [xsl] Flatten a node set into a single string
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 7 Dec 2018 14:36:19 -0000
On Fri, Dec 07, 2018 at 02:16:33PM -0000, Rick Quatro rick@xxxxxxxxxxxxxx scripsit:
[snip]
> title/text()
> 
> I get a sequence of text nodes. What I really want is a single string:
> 
> 1914-1918 - World War One

title/normalize-space() should do it.  (But might have trouble if there
are two processing instructions with a space between them in the middle
of a word, or something like that.)

It can often be better to use the identity transform first to delete all
the processing instructions and get text node merging to fix nigh-all of
the line break problem before doing the main processing.

-- Graydon

Current Thread