Mercurial > hg > ooxml
changeset 41:afda541de4c4
working again with new refs
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Tue, 02 May 2017 10:00:02 +0100 |
parents | ac6d1ca099f7 |
children | 6f448ac67778 |
files | refs2.xsl |
diffstat | 1 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/refs2.xsl Tue May 02 09:20:13 2017 +0100 +++ b/refs2.xsl Tue May 02 10:00:02 2017 +0100 @@ -2,26 +2,35 @@ <!DOCTYPE doc SYSTEM "../../../lib/xml/xsl.dtd" > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:e="http://markup.co.uk/excel" exclude-result-prefixes="xs e" xmlns="http://markup.co.uk/excel"> <!-- Invert the singleton references extracted from formulae by refs.xsl - Input e:refs/e:ref/e:s e:ref[@r] contains one or more e:s or e:r + Input e:refs/e:ref/(e:s|e:r) e:ref[@r] contains one or more e:s or e:r for each singleton/range reference - to e:s/@r in @r's formula + to [e:r/]e:s/@r in @r's formula Output e:refs/e:i/e:r e:i[@r] contains one e:r for each cell which references r --> <xsl:include href="n2a.xsl"/> <xsl:include href="a2n.xsl"/> - <xsl:key name="ref" match="e:ref" use="for $s in e:s return translate($s/@r,'$','')"/> + <xsl:key name="ref" match="e:ref[e:s]" use="for $s in e:s return translate($s/@r,'$','')"/> + <xsl:key name="rrefTL" match="e:ref[e:r]" use="for $s in e:r/(e:s[1]) return translate($s/@r,'$','')"/> + <xsl:key name="rrefBR" match="e:ref[e:r]" use="for $s in e:r/(e:s[2]) return translate($s/@r,'$','')"/> <xsl:template match="e:refs"> + <xsl:message><xsl:value-of select="count(e:ref/e:r)"/>|<xsl:value-of select="count(e:ref/e:r/(e:s[1]))"/>|<xsl:value-of select="distinct-values(count(e:ref/e:r/(e:s[1])))"/></xsl:message> <xsl:variable name="refs" select="."/> <xsl:variable name="invert"> <xsl:for-each select="distinct-values( - for $s in e:ref/e:s return translate($s/@r,'$',''))"> + for $s in e:ref//e:s return translate($s/@r,'$',''))"> <xsl:variable name="r" select="."/> <i r="{$r}"> <xsl:for-each select="key('ref',$r,$refs)"> - <r><xsl:value-of select="@c"/></r> + <r><xsl:value-of select="@r"/></r> + </xsl:for-each> + <xsl:for-each select="key('rrefTL',$r,$refs)"> + <r><<xsl:value-of select="@r"/></r> + </xsl:for-each> + <xsl:for-each select="key('rrefBR',$r,$refs)"> + <r><xsl:value-of select="@r"/>></r> </xsl:for-each> </i> </xsl:for-each>