Mercurial > hg > ooxml
diff rect.xsl @ 48:5d9806f90896
basic integration of shared, but copying <f> is wrong, should reconstruct by denormalising <nf> for new home
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Wed, 10 May 2017 16:52:04 +0100 |
parents | 3e9a3e51627e |
children | d3569a8cbf7a |
line wrap: on
line diff
--- a/rect.xsl Tue May 09 23:08:18 2017 +0100 +++ b/rect.xsl Wed May 10 16:52:04 2017 +0100 @@ -7,7 +7,35 @@ <xsl:include href="n2a.xsl"/> <xsl:include href="tokenise.xsl"/> + <xsl:variable name="shared"> + <xsl:apply-templates select="collection()[2]/*"/> + </xsl:variable> + + <xsl:key name="shared" match="e:master" use="@si"/> + <xsl:variable name="dim" select="//s:dimension/@ref"/> + + <xsl:function name="e:analyse" as="element(*)*"> + <xsl:param name="formula" as="xs:string"/> + <xsl:param name="row" as="xs:integer"/> + <xsl:param name="col" as="xs:integer"/> + <xsl:variable name="toks" select="e:tokenise($formula,$row,$col)"/> + <xsl:sequence> + <f> + <xsl:copy-of select="$toks"/> + </f> + <nf><xsl:copy-of select="e:fnf($toks)"/></nf> + </xsl:sequence> + </xsl:function> + + <xsl:template match="e:master"> + <xsl:variable name="rp" select="e:pr(@r)"/> + <xsl:copy> + <xsl:copy-of select="@si"/> + <xsl:sequence select="e:analyse(text(),xs:integer($rp//xpf:group[@nr=4]), + e:a2n($rp//xpf:group[@nr=2]))"/> + </xsl:copy> + </xsl:template> <xsl:template match="/"> <xsl:apply-templates select="//s:sheetData"/> @@ -34,15 +62,16 @@ <xsl:if test="$c/*"> <xsl:if test="$c/@e:class"><xsl:attribute name="t"><xsl:value-of select="substring($c/@e:class,1,1)"/></xsl:attribute></xsl:if> <xsl:if test="$c/@e:code"><xsl:attribute name="l"><xsl:value-of select="$c/@e:code"/></xsl:attribute></xsl:if> - <xsl:if test="$c/s:f"> - <xsl:variable name="toks" select="e:tokenise($c/s:f,$row,$col)"/> - <f> - <xsl:copy-of select="$toks"/> - </f> - <nf> - <xsl:copy-of select="e:fnf($toks)"/> - </nf> - </xsl:if> + <xsl:variable name="si" select="$c/s:f/@si"/> + <xsl:copy-of select="$si"/> + <xsl:choose> + <xsl:when test="$c/s:f/text()"> + <xsl:sequence select="e:analyse($c/s:f/text(),$row,$col)"/> + </xsl:when> + <xsl:when test="$c/s:f/@si"> + <xsl:copy-of select="key('shared',$si,$shared)/*"/> + </xsl:when> + </xsl:choose> <xsl:value-of select="substring($c/@e:type,1,1)"/> </xsl:if> </c>