exhibit editgrid xsl stylesheets

9 views
Skip to first unread message

lostexpectation

unread,
Jul 3, 2010, 3:59:43 PM7/3/10
to SIMILE Widgets
hi

http://ecmanaut.blogspot.com/2007/02/jsonp-and-spreadsheets.html
offers exhibit editgrid stylesheets but the files don't seem to be
there anymore?

anyone got 1, thanks

David

unread,
Jul 9, 2010, 1:09:49 PM7/9/10
to SIMILE Widgets
The EditGrid stylesheet that I have been using for Exhibit is below.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<!-- Turns cell data to Exhibit JSONP, by Johan Sundström -->
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="/">
<xsl:text>editgridCallback({"items":[</xsl:text>

<xsl:for-each select="workbook/sheet/row[position()>1]">
<xsl:if test="position() > 1">,</xsl:if>
<xsl:text>&#10;{"type":</xsl:text>
<xsl:call-template name="string">
<xsl:with-param name="data" select="../@name"/>
</xsl:call-template>
<xsl:for-each select="cell[string-length(text()) &gt; 0]">
<xsl:text>,</xsl:text>
<xsl:call-template name="string">
<xsl:with-param name="data"
select="../../row[1]/cell[current()/@col + 1]/text()"/>
</xsl:call-template>
<xsl:text>:</xsl:text>
<xsl:call-template name="string">
<xsl:with-param name="data" select="text()"/>
</xsl:call-template>
</xsl:for-each>
<xsl:text>}</xsl:text>
</xsl:for-each>

<xsl:text>&#10;]})</xsl:text>
</xsl:template>

<xsl:template name="string">
<xsl:param name="data"/>
<xsl:text>&quot;</xsl:text>
<xsl:call-template name="replace">
<xsl:with-param name="data">
<xsl:call-template name="replace">
<xsl:with-param name="data" select="$data"/>
<xsl:with-param name="src" select="'&#10;'"/>
<xsl:with-param name="dst" select="'\n'"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="src" select="'&quot;'"/>
<xsl:with-param name="dst" select="'\&quot;'"/>
</xsl:call-template>
<xsl:text>&quot;</xsl:text>
</xsl:template><!-- end of string -->

<xsl:template name="replace">
<xsl:param name="data"/>
<xsl:param name="src"/>
<xsl:param name="dst"/>
<xsl:choose>
<xsl:when test="contains($data,$src)">
<xsl:value-of select="concat(substring-before($data,$src),
$dst)"/>
<xsl:call-template name="replace">
<xsl:with-param name="data" select="substring-after($data,
$src)"/>
<xsl:with-param name="src" select="$src"/>
<xsl:with-param name="dst" select="$dst"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$data"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>

lostexpectation

unread,
Jul 26, 2010, 6:24:39 AM7/26/10
to SIMILE Widgets
oh just to say thanks i got it and http://ecmanaut.blogspot.com/2007/02/jsonp-and-spreadsheets.html
made the files available again.
working them in with my editgrid files
still getting other errors but i have to figure em out
Reply all
Reply to author
Forward
0 new messages