comparison refs.xsl @ 38:468a6cf8bf0b

big change wrt formulae compiles, crashes
author Henry S. Thompson <ht@markup.co.uk>
date Tue, 25 Apr 2017 22:17:12 +0100
parents ac3cd8de7a10
children ac6d1ca099f7
comparison
equal deleted inserted replaced
37:ac3cd8de7a10 38:468a6cf8bf0b
1 <?xml version='1.0'?> 1 <?xml version='1.0'?>
2 <!DOCTYPE xsl:stylesheet SYSTEM "../../../lib/xml/xsl.dtd" > 2 <!DOCTYPE xsl:stylesheet SYSTEM "../../../lib/xml/xsl.dtd" >
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 e xf" xmlns="http://markup.co.uk/excel" xmlns:xf="http://www.w3.org/2005/xpath-functions"> 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 e xf" xmlns="http://markup.co.uk/excel" xmlns:xf="http://www.w3.org/2005/xpath-functions">
4
5 <xsl:include href="a2n.xsl"/>
6
7 <xsl:param name="sheet-name"/>
4 8
5 <xsl:template match="/"> 9 <xsl:template match="/">
6 <refs sheetName="{$sheet-name}"><xsl:apply-templates select="//s:c"/></refs> 10 <refs sheetName="{$sheet-name}"><xsl:apply-templates select="//s:c"/></refs>
7 </xsl:template> 11 </xsl:template>
8 12
9 <xsl:template match="s:c[s:f]"> 13 <xsl:template match="e:c[e:f]">
10 <xsl:variable name="cr" select="e:cr(@r,0,0)"/> 14 <xsl:variable name="cr" select="e:cr(@r,0,0)"/>
11 <xsl:variable name="tokens" select="e:tokenise(s:f/.,$cr/e:r[1],$cr/e:r[2])"/> 15 <xsl:if test="@r='xxx'"><xsl:message><xsl:value-of select="count(e:f/*)"/>|</xsl:message>
12 <xsl:if test="@r='xxx'"><xsl:message><xsl:value-of select="s:f"/>|<xsl:value-of select="(analyze-string(s:f/.,$pat)/xf:match/xf:group)[3]/@nr"/></xsl:message>
13 </xsl:if> 16 </xsl:if>
14 <xsl:if test="count($tokens)>0">
15 <xsl:variable name="singles" select="$tokens?1"/>
16 <!-- Note that we don't bother to treat external ranges as ranges,
17 since we're not going to try to detect cross-document refs -->
18 <xsl:variable name="ranges" select="$tokens?2"/>
19 <xsl:variable name="externals" select="$tokens?3"/>
20 <!-- Lost distinct-values filter, not sure it's really possible... -->
21 <ref c="{@r}">
22 <xsl:copy-of select="$singles"/>
23 <xsl:copy-of select="$ranges"/>
24 <xsl:copy-of select="$externals"/>
25 </ref></xsl:if>
26 </xsl:template> 17 </xsl:template>
27 18
28 <xsl:template match="s:c"/> 19 <xsl:template match="s:c"/>
29 </xsl:stylesheet> 20 </xsl:stylesheet>