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
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
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
wrote:
> <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"
as="xs:string">prefix{'part1'}....</xsl:variable>

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

Liam

--
Liam Quin,
https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.delight
fulcomputing.com%2F&amp;data=02%7C01%7Cwendell.piez%40nist.gov%7Cf20bdc8b741e
40a1b2e908d74cc8e72f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C63706229807
7477279&amp;sdata=pv1dH6GdCW9MN1YblJAsuuF5p5vKemb%2B4qQwRWXy2lg%3D&amp;reserv
ed=0
Available for XML/Document/Information Architecture/XSLT/ XSL/XQuery/Web/Text
Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:
https://gcc01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.fromoldb
ooks.org&amp;data=02%7C01%7Cwendell.piez%40nist.gov%7Cf20bdc8b741e40a1b2e908d
74cc8e72f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637062298077477279&amp
;sdata=7lZSwqUXp95SSaY14fGCr26cFa%2F%2FgZw6%2FVddfINz%2Boc%3D&amp;reserved=0

Current Thread