view format.xsl @ 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
line wrap: on
line source

<?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" 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="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>