comparison refs2.xsl @ 36:ae605b77d1e4

compute (but not use) master formula cells info, extend refs collection to include abs/reloc info
author Henry S. Thompson <ht@markup.co.uk>
date Tue, 25 Apr 2017 12:24:31 +0100
parents
children ac6d1ca099f7
comparison
equal deleted inserted replaced
35:e500d7c18aad 36:ae605b77d1e4
1 <?xml version='1.0'?>
2 <!DOCTYPE doc SYSTEM "../../../lib/xml/xsl.dtd" >
3 <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">
4 <!-- Invert the singleton references extracted from formulae by refs.xsl
5 Input e:refs/e:ref/e:s e:ref[@c] contains one or more e:s
6 for each singleton reference
7 to e:s/@r in c's formula
8 Output e:refs/e:i/e:r e:i[@r] contains one e:r for each cell which
9 references r -->
10
11 <xsl:include href="n2a.xsl"/>
12 <xsl:include href="a2n.xsl"/>
13
14 <xsl:key name="ref" match="e:ref" use="for $s in e:s return translate($s/@r,'$','')"/>
15
16 <xsl:template match="e:refs">
17 <xsl:variable name="refs" select="."/>
18 <xsl:variable name="invert">
19 <xsl:for-each select="distinct-values(
20 for $s in e:ref/e:s return translate($s/@r,'$',''))">
21 <xsl:variable name="r" select="."/>
22 <i r="{$r}">
23 <xsl:for-each select="key('ref',$r,$refs)">
24 <r><xsl:value-of select="@c"/></r>
25 </xsl:for-each>
26 </i>
27 </xsl:for-each>
28 </xsl:variable>
29 <xsl:copy>
30 <xsl:copy-of select="$invert"/>
31 </xsl:copy>
32 </xsl:template>
33 </xsl:stylesheet>