changeset 19:9b1b169dc8db

use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
author Henry S. Thompson <ht@markup.co.uk>
date Tue, 04 Apr 2017 17:45:50 +0100
parents 16bba7a0d0bd
children 104ef815b0b0
files html.xsl rect.xsl visualise.xpl
diffstat 3 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/html.xsl	Tue Apr 04 16:20:46 2017 +0100
+++ b/html.xsl	Tue Apr 04 17:45:50 2017 +0100
@@ -12,6 +12,7 @@
        td {padding: 0}
        .e {color: red}
        .formula {font-style: italic}
+       .reffed {border: solid 1px black}
     </style>
    </head>
    <body>
@@ -37,7 +38,9 @@
    <xsl:choose>
     <xsl:when test="text()">
      <xsl:attribute name="class">
-      <xsl:value-of select="(.,if (@f) then 'formula' else ())"/>
+      <xsl:value-of select="(.,
+                             if (@f) then 'formula' else (),
+                             if (@r) then 'reffed' else ())"/>
      </xsl:attribute>
      <xsl:value-of select="."/></xsl:when>
     <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
--- a/rect.xsl	Tue Apr 04 16:20:46 2017 +0100
+++ b/rect.xsl	Tue Apr 04 17:45:50 2017 +0100
@@ -3,6 +3,10 @@
 <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 xpf" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xpf="http://www.w3.org/2005/xpath-functions">
  <xsl:strip-space elements="s:sheetData"/>
  
+ <xsl:variable name="refs" select="collection()[2]/*"/>
+ 
+ <xsl:key name="ref" match="e:ref" use="@r"/>
+ 
  <xsl:function name="e:a2n" as="xs:integer">
   <!-- Convert an alphabetic excel column 'index' into a number,
        a sort of base 26 + 1, since 'A' is 1 and 'AA' is 27 -->
@@ -51,8 +55,10 @@
        <xsl:variable name="col" select="."/>
        <xsl:variable name="r" select="concat(e:n2a($col),string($row))"/>
        <xsl:variable name="c" select="$cells[@r=$r]"/>
+        <xsl:variable name="reffed" select="key('ref',$r,$refs)"/>
        <e:c c="{$col}">
         <xsl:if test="$c/s:f"><xsl:attribute name="f">1</xsl:attribute></xsl:if>
+        <xsl:if test="$reffed"><xsl:attribute name="r"><xsl:value-of select="$reffed/@c"/></xsl:attribute></xsl:if>
         <xsl:if test="$c/*"><xsl:value-of select="substring($c/@e:type,1,1)"/></xsl:if>
        </e:c>
       </xsl:for-each></xsl:if>
--- a/visualise.xpl	Tue Apr 04 16:20:46 2017 +0100
+++ b/visualise.xpl	Tue Apr 04 17:45:50 2017 +0100
@@ -31,8 +31,21 @@
    <p:pipe step="ss1" port="result"/>
   </p:input>
   <p:with-param name="elabDir" select="$elabDir"/>
+ </p:xslt> 
+ 
+ <p:load name="ssr">
+  <p:with-option name="href" select="concat($elabDir,'/refs.xsl')"/>
+ </p:load>
+
+ <p:xslt name="refs">
+  <p:input port="source">
+   <p:pipe step="vis" port="source"/>
+  </p:input>
+  <p:input port="stylesheet">
+     <p:pipe step="ssr" port="result"/>
+    </p:input>
  </p:xslt>
- 
+
  <p:load name="ss2">
   <p:with-option name="href" select="concat($elabDir,'/rect.xsl')"/>
  </p:load>
@@ -40,6 +53,7 @@
  <p:xslt name="rect">
    <p:input port="source">
     <p:pipe step="format" port="result"/>
+    <p:pipe step="refs" port="result"/>
    </p:input>
   <p:input port="stylesheet">
    <p:pipe step="ss2" port="result"/>
@@ -51,7 +65,7 @@
    <p:load name="ss3">
     <p:with-option name="href" select="concat($elabDir,'/',$format)"/>
    </p:load>
-   <p:xslt name="asc">
+   <p:xslt name="fmt">
     <p:input port="source">
      <p:pipe step="rect" port="result"/>
     </p:input>