Mercurial > hg > ooxml
annotate refs2.xsl @ 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 |
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 |
41
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
5 Input e:refs/e:ref/(e:s|e:r) e:ref[@r] contains one or more e:s or e:r |
40
ac6d1ca099f7
simplified rect output, refs (not refs2) working again
Henry S. Thompson <ht@markup.co.uk>
parents:
36
diff
changeset
|
6 for each singleton/range reference |
41
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
7 to [e:r/]e:s/@r in @r's formula |
36
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 |
41
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
14 <xsl:key name="ref" match="e:ref[e:s]" use="for $s in e:s return translate($s/@r,'$','')"/> |
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
15 <xsl:key name="rrefTL" match="e:ref[e:r]" use="for $s in e:r/(e:s[1]) return translate($s/@r,'$','')"/> |
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
16 <xsl:key name="rrefBR" match="e:ref[e:r]" use="for $s in e:r/(e:s[2]) return translate($s/@r,'$','')"/> |
36
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
17 |
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
18 <xsl:template match="e:refs"> |
41
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
19 <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> |
36
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
20 <xsl:variable name="refs" select="."/> |
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
21 <xsl:variable name="invert"> |
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
22 <xsl:for-each select="distinct-values( |
41
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
23 for $s in e:ref//e:s return translate($s/@r,'$',''))"> |
36
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
24 <xsl:variable name="r" select="."/> |
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
25 <i r="{$r}"> |
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
26 <xsl:for-each select="key('ref',$r,$refs)"> |
41
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
27 <r><xsl:value-of select="@r"/></r> |
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
28 </xsl:for-each> |
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
29 <xsl:for-each select="key('rrefTL',$r,$refs)"> |
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
30 <r><<xsl:value-of select="@r"/></r> |
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
31 </xsl:for-each> |
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
32 <xsl:for-each select="key('rrefBR',$r,$refs)"> |
afda541de4c4
working again with new refs
Henry S. Thompson <ht@markup.co.uk>
parents:
40
diff
changeset
|
33 <r><xsl:value-of select="@r"/>></r> |
36
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
34 </xsl:for-each> |
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
35 </i> |
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
36 </xsl:for-each> |
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
37 </xsl:variable> |
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
38 <xsl:copy> |
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
39 <xsl:copy-of select="$invert"/> |
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
40 </xsl:copy> |
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
41 </xsl:template> |
ae605b77d1e4
compute (but not use) master formula cells info,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
42 </xsl:stylesheet> |