changeset 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 9b1b169dc8db
files refs.xsl
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/refs.xsl	Tue Apr 04 15:30:04 2017 +0100
+++ b/refs.xsl	Tue Apr 04 16:20:46 2017 +0100
@@ -1,15 +1,17 @@
 <?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">
+<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:f"/></e:refs>
+  <e:refs><xsl:apply-templates select="//s:c"/></e:refs>
  </xsl:template>
  
- <xsl:template match="s:f">
-  <xsl:variable name="tokens" select="analyze-string(.,$pat)"/>
-  <xsl:copy-of select="$tokens"/>
+ <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>