comparison ascii.xsl @ 11:480454d218f7

add markup, indicate if computed or not
author Henry S. Thompson <ht@markup.co.uk>
date Mon, 03 Apr 2017 13:27:32 +0100
parents 01e80c7a9575
children
comparison
equal deleted inserted replaced
10:01e80c7a9575 11:480454d218f7
34 <xsl:variable name="dims" select="analyze-string($dim,'([A-Z]+)([0-9]+):([A-Z]+)([0-9]+)')"/> 34 <xsl:variable name="dims" select="analyze-string($dim,'([A-Z]+)([0-9]+):([A-Z]+)([0-9]+)')"/>
35 <xsl:variable name="height" select="1+xs:integer($dims//xpf:group[@nr='4'])-xs:integer($dims//xpf:group[@nr='2'])"/> 35 <xsl:variable name="height" select="1+xs:integer($dims//xpf:group[@nr='4'])-xs:integer($dims//xpf:group[@nr='2'])"/>
36 <xsl:variable name="width" select="1+e:a2n($dims//xpf:group[@nr='3'])-e:a2n($dims//xpf:group[@nr='1'])"/> 36 <xsl:variable name="width" select="1+e:a2n($dims//xpf:group[@nr='3'])-e:a2n($dims//xpf:group[@nr='1'])"/>
37 <!-- Brute force! --> 37 <!-- Brute force! -->
38 <xsl:variable name="sheet" select="."/> 38 <xsl:variable name="sheet" select="."/>
39 <a> 39 <e:a>
40 <xsl:text>&#10;</xsl:text> 40 <xsl:text>&#10;</xsl:text>
41 <xsl:for-each select="(1 to $height)"> 41 <xsl:for-each select="(1 to $height)"><xsl:variable name="row" select="."/>
42 <xsl:variable name="row" select="."/> 42 <e:r r="{$row}">
43 <xsl:for-each select="(1 to $width)"> 43 <xsl:for-each select="(1 to $width)">
44 <xsl:variable name="col" select="."/> 44 <xsl:variable name="col" select="."/>
45 <xsl:variable name="r" select="concat(e:n2a($col),string($row))"/> 45 <xsl:variable name="r" select="concat(e:n2a($col),string($row))"/>
46 <xsl:variable name="c" select="$sheet/s:row/s:c[@r=$r]"></xsl:variable> 46 <xsl:variable name="c" select="$sheet/s:row/s:c[@r=$r]"/>
47 <xsl:value-of select="if (count($c)=1) then substring($c/@e:type,1,1) else ' '"/> 47 <e:c c="{$col}">
48 </xsl:for-each> 48 <xsl:if test="$c/s:f"><xsl:attribute name="f">1</xsl:attribute></xsl:if>
49 <xsl:text>&#10;</xsl:text> 49 <xsl:if test="$c"><xsl:value-of select="substring($c/@e:type,1,1)"/></xsl:if>
50 </xsl:for-each></a> 50 </e:c>
51 </xsl:for-each>
52 </e:r>
53 <xsl:text>&#10;</xsl:text></xsl:for-each>
54 </e:a>
51 </xsl:if> 55 </xsl:if>
52 </xsl:template> 56 </xsl:template>
53 </xsl:stylesheet> 57 </xsl:stylesheet>