[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Inserting a separator only between non-empty strin

Subject: Re: Inserting a separator only between non-empty strings (XSLT 2)
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Fri, 18 May 2007 19:18:46 +0200
Re:  Inserting a separator only between non-empty strin
Michael Kay wrote:

Suggestion:


<xsl:variable name="result" select="string-join((string($a), string($b), string($c))[.], '|')"/>

Another suggestion


<xsl:value-of select="($a, $b, $c)[.]" separator="|" />

if content contains nodes, including empty ones which you don't want output, you can change it to:

<xsl:value-of select="($a, $b, $c)[string(.)]" separator="|" />

if you do not want relevant whitespace-only nodes to appear (you can also use strip-space or) :

<xsl:value-of select="($a, $b, $c)[normalize-space(.)]" separator="|" />


Cheers, -- Abel Braaksma

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.