diff merge.xsl @ 42:6f448ac67778

merge working with new refs(2), rect
author Henry S. Thompson <ht@markup.co.uk>
date Tue, 02 May 2017 10:20:59 +0100
parents
children 6ed900e8cc61
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/merge.xsl	Tue May 02 10:20:59 2017 +0100
@@ -0,0 +1,25 @@
+<?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 e s xpf" xmlns="http://markup.co.uk/excel" xmlns:xpf="http://www.w3.org/2005/xpath-functions">
+ <xsl:strip-space elements="s:sheetData"/>
+ 
+ <xsl:include href="a2n.xsl"/>
+ <xsl:include href="n2a.xsl"/> 
+ 
+ <xsl:variable name="refs" select="collection()[2]/*"/>
+ 
+ <xsl:key name="ref" match="e:i" use="@r"/>
+
+ <xsl:template match="e:r/e:c">
+  <xsl:variable name="row" select="../@r"/>
+  <xsl:variable name="col" select="@c"/>
+  <xsl:variable name="reffed" select="key('ref',concat(e:n2a($col),$row),$refs)"/>
+  <c>
+   <xsl:apply-templates select="node()|@*"/>
+  <xsl:if test="$reffed"><xsl:copy-of select="$reffed"/></xsl:if>
+  </c>
+ </xsl:template>
+ 
+ <xsl:template match="@*|node()"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
+ </xsl:template>
+</xsl:stylesheet>