changeset 4:fe3fc6b2d890

1st level of format type lookup
author Henry S. Thompson <ht@markup.co.uk>
date Sat, 01 Apr 2017 21:44:19 +0800
parents 2c115aefde6b
children 106bf970a867
files format.xsl
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/format.xsl	Sat Apr 01 12:57:31 2017 +0800
+++ b/format.xsl	Sat Apr 01 21:44:19 2017 +0800
@@ -1,10 +1,17 @@
 <?xml version='1.0'?>
 <!DOCTYPE doc SYSTEM "../../../lib/xml/xsl.dtd" >
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:s="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:s="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:e="http://markup.co.uk/excel">
+ <xsl:param name="elabDir"/>
  <xsl:variable name="xldir" select="replace(base-uri(),'/[^/]*/[^/]*$','')"/>
+ <xsl:variable name="fmts" select="document($elabDir/fmt.xml)/fmts/fmt"/>
  <xsl:variable name="styles" select="document(concat($xldir,'/styles.xml'))/*"></xsl:variable>
- <xsl:variable name="cellXfs" select="$styles//s:cellXfs"/>
- <xsl:template match="/">
-  <xsl:message>|<xsl:value-of select="count($cellXfs/s:xf)"/>|</xsl:message>
+ <xsl:variable name="xfs" select="$styles//s:cellXfs/s:xf"/>
+ <xsl:template match="s:c">
+  <xsl:if test="@s">
+   <s:c e:type="{$xfs[position()=current()/@s]/@numFmtId}">
+    <xsl:for-each select="@*"><xsl:copy/></xsl:for-each>
+    <xsl:apply-templates/>
+   </s:c>
+  </xsl:if>
  </xsl:template>
 </xsl:stylesheet>