Hi,
I am kindly asking for help with the following problem. It looks like a
FAQ, but I couldn't find it in Dave Pawson's XSLT 2 FAQ section.
I am declaring 3 variables named a, b, c which must receive their values
not from the "select" attribute of xsl:variable, but from its element
contents which contain each zero, one or more instances of xsl:text,
xsl:value-of or xsl:sequence. All 3 variables are meant to convey
strings only - but I suppose, as a consequence of the way they are
declared, they actually carry text nodes.
Which is the easiest way to join these 3 values into the value of a new
variable named result (just a string), given that only those values
which evaluate to non-empty strings should be separated by "|"?
Do I need explicit testing on each value for the empty string or can I
use a more concise technique?
I tried
<xsl:variable name="result">
<xsl:value-of separator="|">
<xsl:value-of select="$a"/>
<xsl:value-of select="$b"/>
<xsl:value-of select="$c"/>
</xsl:value-of>
</xsl:variable>
but this does never insert a separator. Replacing xsl:value-of with
xsl:sequence for the variable references always inserts the separator,
even near empty strings which is what I want to avoid.
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>
--~--