Mercurial > hg > ooxml
annotate merge.xsl @ 74:7827e686be75 default tip
refactoring again...
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Wed, 05 Jul 2017 18:26:27 +0100 |
parents | f90bbd38b8f6 |
children |
rev | line source |
---|---|
42
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
1 <?xml version='1.0'?> |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
2 <!DOCTYPE doc SYSTEM "../../../lib/xml/xsl.dtd" > |
6f448ac67778
merge working with new refs(2), rect
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:s="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:e="http://markup.co.uk/excel" exclude-result-prefixes="xs e s xpf" xmlns="http://markup.co.uk/excel" xmlns:xpf="http://www.w3.org/2005/xpath-functions"> |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
4 <xsl:strip-space elements="s:sheetData"/> |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
5 |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
6 <xsl:include href="a2n.xsl"/> |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
7 <xsl:include href="n2a.xsl"/> |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
8 |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
9 <xsl:variable name="refs" select="collection()[2]/*"/> |
47
3e9a3e51627e
explicit form match working, but shared still needs work
Henry S. Thompson <ht@markup.co.uk>
parents:
45
diff
changeset
|
10 <xsl:variable name="nfs"> |
3e9a3e51627e
explicit form match working, but shared still needs work
Henry S. Thompson <ht@markup.co.uk>
parents:
45
diff
changeset
|
11 <xsl:for-each select="$refs/e:nf"> |
3e9a3e51627e
explicit form match working, but shared still needs work
Henry S. Thompson <ht@markup.co.uk>
parents:
45
diff
changeset
|
12 <xsl:sort select="@n" order="descending" data-type="number"/> |
3e9a3e51627e
explicit form match working, but shared still needs work
Henry S. Thompson <ht@markup.co.uk>
parents:
45
diff
changeset
|
13 <xsl:message><xsl:value-of select="@n"/>|<xsl:value-of select="position()"/>|<xsl:value-of select="text()"/></xsl:message> |
3e9a3e51627e
explicit form match working, but shared still needs work
Henry S. Thompson <ht@markup.co.uk>
parents:
45
diff
changeset
|
14 <e:nf i="{position()}" n="{@n}"><xsl:value-of select="text()"/></e:nf> |
3e9a3e51627e
explicit form match working, but shared still needs work
Henry S. Thompson <ht@markup.co.uk>
parents:
45
diff
changeset
|
15 </xsl:for-each> |
3e9a3e51627e
explicit form match working, but shared still needs work
Henry S. Thompson <ht@markup.co.uk>
parents:
45
diff
changeset
|
16 </xsl:variable> |
42
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
17 |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
18 <xsl:key name="ref" match="e:i" use="@r"/> |
47
3e9a3e51627e
explicit form match working, but shared still needs work
Henry S. Thompson <ht@markup.co.uk>
parents:
45
diff
changeset
|
19 <xsl:key name="nf" match="e:nf" use="text()"/> |
3e9a3e51627e
explicit form match working, but shared still needs work
Henry S. Thompson <ht@markup.co.uk>
parents:
45
diff
changeset
|
20 |
48
5d9806f90896
basic integration of shared, but copying <f> is wrong, should reconstruct by denormalising <nf> for new home
Henry S. Thompson <ht@markup.co.uk>
parents:
47
diff
changeset
|
21 <xsl:template match="/xxx"><a><xsl:copy-of select="$nfs"/>|<xsl:value-of select="count($refs/e:i)"/>|<xsl:value-of select="count($nfs/e:nf)"/>|<xsl:value-of select="count(key('nf','SUM(ª2ª7:ª3ª7)',$nfs))"/>|<xsl:value-of select="count($nfs/e:nf[.='SUM(ª2ª7:ª3ª7)'])"/> |
47
3e9a3e51627e
explicit form match working, but shared still needs work
Henry S. Thompson <ht@markup.co.uk>
parents:
45
diff
changeset
|
22 <xsl:apply-templates/></a> |
3e9a3e51627e
explicit form match working, but shared still needs work
Henry S. Thompson <ht@markup.co.uk>
parents:
45
diff
changeset
|
23 </xsl:template> |
42
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
24 |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
25 <xsl:template match="e:r/e:c"> |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
26 <xsl:variable name="row" select="../@r"/> |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
27 <xsl:variable name="col" select="@c"/> |
59
f90bbd38b8f6
towards display of reffed info via colour
Henry S. Thompson <ht@markup.co.uk>
parents:
48
diff
changeset
|
28 <xsl:variable name="r" select="concat(e:n2a($col),$row)"/> |
f90bbd38b8f6
towards display of reffed info via colour
Henry S. Thompson <ht@markup.co.uk>
parents:
48
diff
changeset
|
29 <xsl:variable name="reffed" select="key('ref',$r,$refs)"/> |
42
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
30 <c> |
45
6ed900e8cc61
towards comparable formulae
Henry S. Thompson <ht@markup.co.uk>
parents:
42
diff
changeset
|
31 <xsl:apply-templates select="@*"/> |
6ed900e8cc61
towards comparable formulae
Henry S. Thompson <ht@markup.co.uk>
parents:
42
diff
changeset
|
32 <xsl:if test="e:f"> |
59
f90bbd38b8f6
towards display of reffed info via colour
Henry S. Thompson <ht@markup.co.uk>
parents:
48
diff
changeset
|
33 <xsl:attribute name="r"><xsl:value-of select="$r"/></xsl:attribute> |
47
3e9a3e51627e
explicit form match working, but shared still needs work
Henry S. Thompson <ht@markup.co.uk>
parents:
45
diff
changeset
|
34 <xsl:attribute name="fi"><xsl:value-of select="key('nf',e:nf/text(),$nfs)/@i"/></xsl:attribute> |
45
6ed900e8cc61
towards comparable formulae
Henry S. Thompson <ht@markup.co.uk>
parents:
42
diff
changeset
|
35 </xsl:if> |
42
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
36 <xsl:if test="$reffed"><xsl:copy-of select="$reffed"/></xsl:if> |
47
3e9a3e51627e
explicit form match working, but shared still needs work
Henry S. Thompson <ht@markup.co.uk>
parents:
45
diff
changeset
|
37 <xsl:apply-templates select="node()"/> |
42
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
38 </c> |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
39 </xsl:template> |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
40 |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
41 <xsl:template match="@*|node()"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy> |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
42 </xsl:template> |
6f448ac67778
merge working with new refs(2), rect
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
43 </xsl:stylesheet> |