xsl-list
[Top] [All Lists]

Re: [xsl] Typing variables

2012-09-18 02:59:30

I would write it as

<xsl:variable name="thing" type="xs:string"
select="string-join(for $t in tokenize(., ',') return concat('&quot;', $t, '&quot;'), ',')"/>

i.e avoid construction of text nodes, keep it all in terms of atomic values.

Michael Kay
Saxonica

On 18/09/2012 07:29, Ihe Onwuka wrote:
If I have an element <elem>A,B,C</elem> and I want it to render as
JSON - "elem":["A","B","C"], so I do

"<xsl;value-of select="local-name(),$thinge" separator='":['/>] where $thing is

<xsl:variable name="thing">"<xsl:value-of
select="replace(.,',',concat($quot,',',$quot))"/>"</xsl:variable> and
the value of the variable $quot is obvious.

If I were to make $thing a typed variable what would it  be.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>