annotate a2n.xsl @ 35:e500d7c18aad

Fixed confusion wrt gen vs. num, nature of @ format (id=49)
author Henry S. Thompson <ht@markup.co.uk>
date Thu, 13 Apr 2017 23:09:58 +0100
parents 93fd0d532754
children ae605b77d1e4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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:e="http://markup.co.uk/excel" xmlns:xs="http://www.w3.org/2001/XMLSchema" 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:function name="e:a2n" as="xs:integer">
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
5 <!-- Convert an alphabetic excel column 'index' into a number,
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
6 a sort of base 26 + 1, since 'A' is 1 and 'AA' is 27 -->
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
7 <xsl:param name="aa" as="xs:string"/>
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
8 <xsl:value-of select="let $l := string-length($aa),
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
9 $lv := string-to-codepoints(substring($aa,$l))-$codeBase
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
10 return if ($l=1) then $lv
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
11 else $lv+(26*e:a2n(substring($aa,1,$l - 1)))"/>
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 </xsl:stylesheet>