Re: [xsl] Typing variables

Subject: Re: [xsl] Typing variables
From: Ihe Onwuka <ihe.onwuka@xxxxxxxxxxxxxx>
Date: Tue, 18 Sep 2012 11:14:36 +0100
On Tue, Sep 18, 2012 at 11:06 AM, Andrew Welch <andrew.j.welch@xxxxxxxxx> wrote:
>> "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.
>
> Not sure I follow... the general good practice rule is: always use the
> as attribute.
>

Assign a type to

<xsl:variable name="val">"<xsl:sequence
select="replace(.,',',concat($quot,',',$quot))"/>"</xsl:variable

such that

 <xsl:template match="m__category">
       <xsl:variable name="val">"<xsl:sequence
select="replace(.,',',concat($quot,',',$quot))"/>"</xsl:variable>
       "<xsl:value-of select="if (contains(local-name(),'__')) then
                                 substring-after(local-name(),'__') else
                                 local-name()
                              ,$val"
                      separator='":['/>]<xsl:text/>
    </xsl:template>

applied to
<m__category>_IOS, _WEB, _CTV</m__category> yields

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

Current Thread