[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Typing variables

Subject: Re: [xsl] Typing variables
From: Ihe Onwuka <ihe.onwuka@xxxxxxxxxxxxxx>
Date: Tue, 18 Sep 2012 10:27:49 +0100

On Tue, Sep 18, 2012 at 10:04 AM, Andrew Welch <andrew.j.welch@xxxxxxxxx> wrote:
>> Yes but my original question was what was the type of
>> <xsl:variable name="thing">"<xsl:value-of
>> select="replace(.,',',concat($quot,',',$quot))"/>"</xsl:variable> and
>> the value of the variable $quot is obvious.
>> precisely because xs:string+ (although it types checks) wasn't giving
>> the right result and omitting a type does.
> Ahh - when you omit 'sequence type' (the as attribute) the contents of
> the variable will be a document node with text node children, where
> adjacent text nodes get merged.... leaving you with a document node
> with a single text node child.

Let me rephrase my original question to clarify it's intent.

Given that typing the variable as xs:string+ converts
<m__category>_IOS, _WEB, _CTV</m__category> into

"category":["":[_IOS"," _WEB"," _CTV":["],

and I want

"category":["_IOS"," _WEB"," _CTV"] which is what I get if I don't
type it, what should the type be to get the answer I want.

Looking at the incorrect result I see that solution to  my question
doesn't lie in typing as the " in the variable are causing incorrect
placement of the separator.

Current Thread