[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] minified json output
Subject: Re: [xsl] minified json output From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 29 Jan 2015 15:34:08 -0000 |
On 29 Jan 2015, at 14:21, Rushforth, Peter peter.rushforth@xxxxxxxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > The link below requires authentication. Sorry, I should have linked to the public version: http://www.w3.org/TR/xslt-30/#xml-to-json-stylesheet > > Dmitris suggestion and your direction have helped. Essentially we have got literal json strings/string parts in the <xsl:template>. > > For example : > > <xsl:template match =/> > { > <xsl:apply-templates select=atom:feed/> > } > </xsl:template> > > What we should do is use variables etc for these strings, which will lead to more readable code plus minified json > > Perhaps : > <xsl:template match =/> > <xsl:value-of select={/> > <xsl:apply-templates select=atom:feed/> > <xsl:value-of select=}/> > </xsl:template> > > Either that or > <xsl:template match =/> > <xsl:text>{</xsl:text> > <xsl:apply-templates select=atom:feed/> > <xsl:text>}</xsl:text> > </xsl:template> Or if you're into DTDs > <xsl:template match =/> > &OPENCURLY; > <xsl:apply-templates select=atom:feed/> > &CLOSECURLY; > </xsl:template> where the entity references expand to xsl:text elements.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] minified json output, Rushforth, Peter pet | Thread | Re: [xsl] minified json output, Rushforth, Peter pet |
Re: [xsl] minified json output, Rushforth, Peter pet | Date | [xsl] Creating a container element , Michael Friedman sum |
Month |