annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
1 <?xml version='1.0'?>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
2 <!DOCTYPE doc SYSTEM "../../../lib/xml/xsl.dtd" >
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
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">
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
4 <!-- Invert the singleton references extracted from formulae by refs.xsl
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
5 Input e:refs/e:ref/e:s e:ref[@c] contains one or more e:s
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
6 for each singleton reference
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
7 to e:s/@r in c's formula
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
8 Output e:refs/e:i/e:r e:i[@r] contains one e:r for each cell which
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
9 references r -->
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
10
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
11 <xsl:include href="n2a.xsl"/>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
12 <xsl:include href="a2n.xsl"/>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
13
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
14 <xsl:key name="ref" match="e:ref" use="for $s in e:s return translate($s/@r,'$','')"/>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
15
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
16 <xsl:template match="e:refs">
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
17 <xsl:variable name="refs" select="."/>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
18 <xsl:variable name="invert">
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
19 <xsl:for-each select="distinct-values(
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
20 for $s in e:ref/e:s return translate($s/@r,'$',''))">
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
21 <xsl:variable name="r" select="."/>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
22 <i r="{$r}">
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
23 <xsl:for-each select="key('ref',$r,$refs)">
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
24 <r><xsl:value-of select="@c"/></r>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
25 </xsl:for-each>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
26 </i>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
27 </xsl:for-each>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
28 </xsl:variable>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
29 <xsl:copy>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
30 <xsl:copy-of select="$invert"/>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
31 </xsl:copy>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
32 </xsl:template>
ae605b77d1e4 compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
33 </xsl:stylesheet>