diff backref.xsl @ 59:f90bbd38b8f6

towards display of reffed info via colour
author Henry S. Thompson <ht@markup.co.uk>
date Fri, 02 Jun 2017 12:54:54 +0100
parents
children 588cb9ba7c9c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backref.xsl	Fri Jun 02 12:54:54 2017 +0100
@@ -0,0 +1,24 @@
+<?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 xpf e" xmlns="http://www.w3.org/1999/xhtml" xmlns:xpf="http://www.w3.org/2005/xpath-functions">
+ 
+ <xsl:import href="n2a.xsl"/>
+  
+ <xsl:key name="fcell" match="e:c[@fi]" use="@r"/>
+
+ <xsl:template match="e:i">
+  <xsl:variable name="row" select="../../@r"/>
+  <xsl:variable name="col" select="../@c"/>
+  <xsl:variable name="r" select="concat(e:n2a($col),$row)"/>
+  <xsl:variable name="ris" select="for $r in e:r/text()
+                                    return key('fcell',$r)/@fi"/>
+  <xsl:copy>
+   <xsl:attribute name="ri"><xsl:value-of select="string-join($ris,',')"/></xsl:attribute>
+   <xsl:apply-templates select="node()|@*"/>
+  </xsl:copy>
+ </xsl:template>
+ 
+ <xsl:template match="@*|node()"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
+ </xsl:template>
+ 
+</xsl:stylesheet>