view refs.xsl @ 20:104ef815b0b0

fix false negs, add mouseover to show refs
author Henry S. Thompson <ht@markup.co.uk>
date Tue, 04 Apr 2017 18:04:13 +0100
parents 16bba7a0d0bd
children f05f0d0ee296
line wrap: on
line source

<?xml version='1.0'?>
<!DOCTYPE doc SYSTEM "../../../lib/xml/xsl.dtd" >
<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">
  <xsl:variable name="pat1">("[^"]*")|(\{[^}]+})|(,)|([^=\-+*/();:,.$&lt;>^!]+(?:\.[^=\-+*/();:,.$&lt;>^!]+)*\()|([)])|(^=|\()|((?:'[^']+')|(?:\[[0-9]+\][^!]*))|(\$?[A-Z]+\$?[0-9]+)|([a-zA-Z_\\][a-zA-Z0-9._]*)|(.)</xsl:variable>
 <xsl:param name="pat" select="$pat1"/>

 <xsl:template match="/">
  <e:refs><xsl:apply-templates select="//s:c"/></e:refs>
 </xsl:template>
 
 <xsl:template match="s:c[s:f]">
  <xsl:variable name="refs" select="analyze-string(.,$pat)/xf:match/xf:group[@nr=8]"/>
  <xsl:if test="$refs"><e:ref c="{@r}" r="{for $ref in $refs return translate($ref,'$','')}"/></xsl:if>
 </xsl:template>
 
 <xsl:template match="s:c"/>
</xsl:stylesheet>