view backref.xsl @ 74:7827e686be75 default tip

refactoring again...
author Henry S. Thompson <ht@markup.co.uk>
date Wed, 05 Jul 2017 18:26:27 +0100
parents 588cb9ba7c9c
children
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 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>