Mercurial > hg > ooxml
annotate refs.xsl @ 21:f05f0d0ee296
fix false positives
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Wed, 05 Apr 2017 11:24:11 +0100 |
parents | 16bba7a0d0bd |
children | ca98c74a7cb1 |
rev | line source |
---|---|
17
a874f2a81ed2
default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
1 <?xml version='1.0'?> |
a874f2a81ed2
default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
2 <!DOCTYPE doc SYSTEM "../../../lib/xml/xsl.dtd" > |
18
16bba7a0d0bd
one form of refs output, not sure it's what is wanted...
Henry S. Thompson <ht@markup.co.uk>
parents:
17
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 s" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xf="http://www.w3.org/2005/xpath-functions"> |
17
a874f2a81ed2
default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
4 <xsl:variable name="pat1">("[^"]*")|(\{[^}]+})|(,)|([^=\-+*/();:,.$<>^!]+(?:\.[^=\-+*/();:,.$<>^!]+)*\()|([)])|(^=|\()|((?:'[^']+')|(?:\[[0-9]+\][^!]*))|(\$?[A-Z]+\$?[0-9]+)|([a-zA-Z_\\][a-zA-Z0-9._]*)|(.)</xsl:variable> |
a874f2a81ed2
default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
5 <xsl:param name="pat" select="$pat1"/> |
a874f2a81ed2
default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
6 |
a874f2a81ed2
default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
7 <xsl:template match="/"> |
18
16bba7a0d0bd
one form of refs output, not sure it's what is wanted...
Henry S. Thompson <ht@markup.co.uk>
parents:
17
diff
changeset
|
8 <e:refs><xsl:apply-templates select="//s:c"/></e:refs> |
17
a874f2a81ed2
default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
9 </xsl:template> |
a874f2a81ed2
default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
10 |
18
16bba7a0d0bd
one form of refs output, not sure it's what is wanted...
Henry S. Thompson <ht@markup.co.uk>
parents:
17
diff
changeset
|
11 <xsl:template match="s:c[s:f]"> |
21 | 12 <xsl:variable name="tokens" select="analyze-string(.,$pat)/xf:match/xf:group"/> |
13 <xsl:if test="@r='B1'"><xsl:message><xsl:value-of select="$tokens/@nr"/></xsl:message> | |
14 <xsl:message><xsl:value-of select="$tokens/."/></xsl:message> | |
15 </xsl:if> | |
16 <xsl:if test="$tokens[@nr=8]"> | |
17 <xsl:variable name="n" select="count($tokens)"/> | |
18 <xsl:variable name="singles" select="for $i in (1 to $n) | |
19 return if ($tokens[$i][@nr=8] and not($tokens[$i - 1][@nr=10 and .=(':','!')]) and not($tokens[$i + 1][@nr=10 and .=':'])) | |
20 then translate($tokens[$i],'$','') | |
21 else ()"/> | |
22 <xsl:variable name="ranges" select="for $i in (1 to count($tokens)) | |
23 return if ($tokens[$i][@nr=10 and .=':' and | |
24 not($i gt 2 and | |
25 $tokens[$i - 2][@nr=10 and .='!'])]) | |
26 then translate(concat($tokens[$i - 1],':',$tokens[$i + 1]),'$','') | |
27 else ()"/> | |
28 <xsl:variable name="externals" select="for $i in (1 to count($tokens)) | |
29 return if ($tokens[$i][@nr=7]) | |
30 then | |
31 let $bit := concat($tokens[$i],'!', | |
32 translate($tokens[$i + 2],'$','')) | |
33 return if ((($i+3) le $n) and $tokens[$i + 3][@nr=10 and .=':']) | |
34 then concat($bit,':',translate($tokens[$i + 4],'$','')) | |
35 else $bit | |
36 else ()"/> | |
37 <e:ref c="{@r}" r="{$singles}" rr="{$ranges}" er="{$externals}"/></xsl:if> | |
17
a874f2a81ed2
default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
38 </xsl:template> |
18
16bba7a0d0bd
one form of refs output, not sure it's what is wanted...
Henry S. Thompson <ht@markup.co.uk>
parents:
17
diff
changeset
|
39 |
16bba7a0d0bd
one form of refs output, not sure it's what is wanted...
Henry S. Thompson <ht@markup.co.uk>
parents:
17
diff
changeset
|
40 <xsl:template match="s:c"/> |
17
a874f2a81ed2
default vis pipeline to raw xml, start extracting refs
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
41 </xsl:stylesheet> |