Mercurial > hg > ooxml
comparison a2n.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 | ae605b77d1e4 |
comparison
equal
deleted
inserted
replaced
33:27bffc66ce10 | 34:93fd0d532754 |
---|---|
1 <?xml version='1.0'?> | |
2 <!DOCTYPE xsl:stylesheet SYSTEM "file:///C:/C64/home/ht/lib/xml/xsl.dtd" > | |
3 <xsl:stylesheet xmlns:e="http://markup.co.uk/excel" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="3.0"> | |
4 <xsl:function name="e:a2n" as="xs:integer"> | |
5 <!-- Convert an alphabetic excel column 'index' into a number, | |
6 a sort of base 26 + 1, since 'A' is 1 and 'AA' is 27 --> | |
7 <xsl:param name="aa" as="xs:string"/> | |
8 <xsl:value-of select="let $l := string-length($aa), | |
9 $lv := string-to-codepoints(substring($aa,$l))-$codeBase | |
10 return if ($l=1) then $lv | |
11 else $lv+(26*e:a2n(substring($aa,1,$l - 1)))"/> | |
12 </xsl:function> | |
13 </xsl:stylesheet> |