xsl-list
[Top] [All Lists]

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

2007-05-18 04:02:02
Thank you very much for your explanation, Michael. Now I understand better why things have to be this way.

The solution you suggested works perfectly for me. I am just a bit disappointed that XSLT 2 doesn't provide with me a more elegant construct that would make life even easier for me (like XSLT 2 already did in a lot of cases). :-)


mozer wrote:
and what about that ?

<xsl:variable name="concat">
<xsl:sequence>
 <xsl:value-of select="$a"/>
 <xsl:value-of select="$b"/>
 <xsl:value-of select="$c"/>
</xsl:sequence>
</xsl:variable>
<xsl:value-of separator="|" select="$concat[string-length(.) gt 0]"/>

Unfortunately, this won't work, as xsl:sequence only allows to use the select attribute here, not its element content. However, adapting it a little I get

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

which seems to work (but I am not sure). Anyway, I prefer Michael's solution.

  Yves


--~------------------------------------------------------------------
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>
--~--