Mercurial > hg > ooxml
annotate n2a.xsl @ 34:93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
adapt html and ascii to new-format refs,
move a2n and n2a into separate files for re-use
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Wed, 12 Apr 2017 21:35:04 +0100 |
parents | |
children | 5469a32795da |
rev | line source |
---|---|
34
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
1 <?xml version='1.0'?> |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
2 <!DOCTYPE xsl:stylesheet SYSTEM "file:///C:/C64/home/ht/lib/xml/xsl.dtd" > |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
3 <xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:e="http://markup.co.uk/excel" version="3.0"> |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
4 <xsl:variable name="codeBase" select="string-to-codepoints('A')-1"/> |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
5 |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
6 <xsl:function name="e:n2aa" as="xs:integer*"> |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
7 <!-- Does the real work for e:n2a --> |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
8 <xsl:param name="n" as="xs:integer"/> |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
9 <xsl:sequence select="let $least := $codeBase+(($n - 1) mod 26)+1 |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
10 return if ($n < 27) then $least |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
11 else (e:n2aa($n idiv 26),$least)"/> |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
12 </xsl:function> |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
13 |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
14 <xsl:function name="e:n2a" as="xs:string"> |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
15 <!-- Invert the a2n computation --> |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
16 <xsl:param name="n" as="xs:integer"/> |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
17 <xsl:value-of select="codepoints-to-string(e:n2aa($n))"/> |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
18 </xsl:function> |
93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
19 </xsl:stylesheet> |