xsl-list
[Top] [All Lists]

Re: [xsl] Inserting a separator only between non-empty strings (XSLT 2)

2007-05-18 10:21:23
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--