diff 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
line wrap: on
line diff
--- a/ascii.xsl	Mon Apr 03 12:31:58 2017 +0100
+++ b/ascii.xsl	Mon Apr 03 13:27:32 2017 +0100
@@ -36,18 +36,22 @@
    <xsl:variable name="width" select="1+e:a2n($dims//xpf:group[@nr='3'])-e:a2n($dims//xpf:group[@nr='1'])"/>
    <!-- Brute force! -->
    <xsl:variable name="sheet" select="."/>
-   <a>
+   <e:a>
     <xsl:text>&#10;</xsl:text>
-    <xsl:for-each select="(1 to $height)">
-    <xsl:variable name="row" select="."/>
-    <xsl:for-each select="(1 to $width)">
-     <xsl:variable name="col" select="."/>
-     <xsl:variable name="r" select="concat(e:n2a($col),string($row))"/>
-     <xsl:variable name="c" select="$sheet/s:row/s:c[@r=$r]"></xsl:variable>
-     <xsl:value-of select="if (count($c)=1) then substring($c/@e:type,1,1) else ' '"/>
-    </xsl:for-each>
-     <xsl:text>&#10;</xsl:text>
-   </xsl:for-each></a>
+    <xsl:for-each select="(1 to $height)"><xsl:variable name="row" select="."/>
+     <e:r r="{$row}">
+      <xsl:for-each select="(1 to $width)">
+       <xsl:variable name="col" select="."/>
+       <xsl:variable name="r" select="concat(e:n2a($col),string($row))"/>
+       <xsl:variable name="c" select="$sheet/s:row/s:c[@r=$r]"/>
+       <e:c c="{$col}">
+        <xsl:if test="$c/s:f"><xsl:attribute name="f">1</xsl:attribute></xsl:if>
+        <xsl:if test="$c"><xsl:value-of select="substring($c/@e:type,1,1)"/></xsl:if>
+       </e:c>
+      </xsl:for-each>
+     </e:r>
+     <xsl:text>&#10;</xsl:text></xsl:for-each>
+   </e:a>
   </xsl:if>
  </xsl:template>
 </xsl:stylesheet>