comparison refs.xsl @ 18:16bba7a0d0bd

one form of refs output, not sure it's what is wanted...
author Henry S. Thompson <ht@markup.co.uk>
date Tue, 04 Apr 2017 16:20:46 +0100
parents a874f2a81ed2
children f05f0d0ee296
comparison
equal deleted inserted replaced
17:a874f2a81ed2 18:16bba7a0d0bd
1 <?xml version='1.0'?> 1 <?xml version='1.0'?>
2 <!DOCTYPE doc SYSTEM "../../../lib/xml/xsl.dtd" > 2 <!DOCTYPE doc 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" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> 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">
4 <xsl:variable name="pat1">("[^"]*")|(\{[^}]+})|(,)|([^=\-+*/();:,.$&lt;>^!]+(?:\.[^=\-+*/();:,.$&lt;>^!]+)*\()|([)])|(^=|\()|((?:'[^']+')|(?:\[[0-9]+\][^!]*))|(\$?[A-Z]+\$?[0-9]+)|([a-zA-Z_\\][a-zA-Z0-9._]*)|(.)</xsl:variable> 4 <xsl:variable name="pat1">("[^"]*")|(\{[^}]+})|(,)|([^=\-+*/();:,.$&lt;>^!]+(?:\.[^=\-+*/();:,.$&lt;>^!]+)*\()|([)])|(^=|\()|((?:'[^']+')|(?:\[[0-9]+\][^!]*))|(\$?[A-Z]+\$?[0-9]+)|([a-zA-Z_\\][a-zA-Z0-9._]*)|(.)</xsl:variable>
5 <xsl:param name="pat" select="$pat1"/> 5 <xsl:param name="pat" select="$pat1"/>
6 6
7 <xsl:template match="/"> 7 <xsl:template match="/">
8 <e:refs><xsl:apply-templates select="//s:f"/></e:refs> 8 <e:refs><xsl:apply-templates select="//s:c"/></e:refs>
9 </xsl:template> 9 </xsl:template>
10 10
11 <xsl:template match="s:f"> 11 <xsl:template match="s:c[s:f]">
12 <xsl:variable name="tokens" select="analyze-string(.,$pat)"/> 12 <xsl:variable name="refs" select="analyze-string(.,$pat)/xf:match/xf:group[@nr=8]"/>
13 <xsl:copy-of select="$tokens"/> 13 <xsl:if test="$refs"><e:ref c="{@r}" r="{for $ref in $refs return translate($ref,'$','')}"/></xsl:if>
14 </xsl:template> 14 </xsl:template>
15
16 <xsl:template match="s:c"/>
15 </xsl:stylesheet> 17 </xsl:stylesheet>