[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Constructing complex xs:string in variable

Subject: Constructing complex xs:string in variable
From: "Christian Roth mulberrytech-lists@xxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 9 Oct 2019 13:27:19 -0000
 Constructing complex xs:string in variable
[re-sending - initial one didn't make it to the listb&?]

Hello,

I'm using XSLT2.

I need to construct a complex string in a variable. I wanted to use XSLT
instructions for this, not pure XPath. I'm struggling with coercing the result
of the <xsl:variable> body to a single xs:string, not a sequence of
xs:string:


<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 (Saxon HE 9): "A sequence of more than one
item is not allowed as the value of variable $var ("prefix", "part1")"

Of course, I could declare the variable as xs:string+ and then use
string-join( $var, '' ) on every use of $var, or create another variable that
holds the concatenated result of $var.

Is there a better way to do this?

Thanks,
Christian

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.