Re: [xsl] Constructing complex xs:string in variable

Subject: Re: [xsl] Constructing complex xs:string in variable
From: "Piez, Wendell A. (Fed) wendell.piez@xxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 10 Oct 2019 12:44:28 -0000
Also let's not forget

<xsl:variable name="var" select="''prefix' || $somevar || 'part'"/>

(as long as we are on the topic)

I agree that the distinction between strings and text nodes is a fine one, but
useful and important to understand. It represents one of the boundaries
between the regimented world of the tree and the open world of XPath.

Cheers, Wendell

-----Original Message-----
From: Liam R. E. Quin liam@xxxxxxxxxxxxxxxx
Sent: Wednesday, October 9, 2019 10:57 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Constructing complex xs:string in variable

On Wed, 2019-10-09 at 13:28 +0000, Christian Roth mulberrytech- lists@xxxxxxxx
> <xsl:variable name="var" as="xs:string">
>   <xsl:text>prefix</xsl:text>
>   <xsl:value-of select="'part1'"/>
>   <!-- follows more complex code producing further fragments of
> desired result string --> </xsl:variable>
> This gives me the error message

Yes - I'd probably write,
<xsl:variable name="var" as="xs:string"
  select="concat('prefix, 'part1', ....) "/>

In XSLT 3 you could also do,
<xsl:variable name="var"

Assuming some XSL ancestor has expand-text="yes"


Liam Quin,;
Available for XML/Document/Information Architecture/XSLT/ XSL/XQuery/Web/Text
Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:;

Current Thread