xsl-list
[Top] [All Lists]

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

2018-12-07 08:35:29
Thank you, Martin. That makes sense.

-----Original Message-----
From: Martin Honnen martin(_dot_)honnen(_at_)gmx(_dot_)de 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 
Sent: Friday, December 07, 2018 9:23 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Flatten a node set into a single string

On 07.12.2018 15:16, Rick Quatro rick(_at_)rickquatro(_dot_)com wrote:

<title><?FM MARKER [Cross-Ref] _bookmark3120?> 1914<?FM MARKER 
[Cross-Ref] _bookmark3121?>
  -1918 <?FM MARKER [Cross-Ref] _bookmark3123?>
- World W<?FM MARKER [Cross-Ref] _bookmark3122?> ar One</title>

When I get this using xpath

title/text()

I get a sequence of text nodes. What I really want is a single string:

1914-1918 - World War One

Do I need to loop through the text nodes and build up a single string? 
I am using XSLT 2.0.


Well, simply select the
   title
element. Its string value then is the concatenation of its text node 
descendants. So
   <xsl:value-of select="title"/>
will do. Or in pure XPath
   string(title)
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>