diff merge.xsl @ 47:3e9a3e51627e

explicit form match working, but shared still needs work
author Henry S. Thompson <ht@markup.co.uk>
date Tue, 09 May 2017 23:08:18 +0100
parents 6ed900e8cc61
children 5d9806f90896
line wrap: on
line diff
--- a/merge.xsl	Sun May 07 22:03:31 2017 +0100
+++ b/merge.xsl	Tue May 09 23:08:18 2017 +0100
@@ -7,8 +7,20 @@
  <xsl:include href="n2a.xsl"/> 
  
  <xsl:variable name="refs" select="collection()[2]/*"/>
+ <xsl:variable name="nfs">
+  <xsl:for-each select="$refs/e:nf">
+   <xsl:sort select="@n" order="descending" data-type="number"/>
+   <xsl:message><xsl:value-of select="@n"/>|<xsl:value-of select="position()"/>|<xsl:value-of select="text()"/></xsl:message>
+   <e:nf i="{position()}" n="{@n}"><xsl:value-of select="text()"/></e:nf>
+  </xsl:for-each>
+ </xsl:variable>
  
  <xsl:key name="ref" match="e:i" use="@r"/>
+ <xsl:key name="nf" match="e:nf" use="text()"/>
+ 
+ <xsl:template match="/"><a><xsl:copy-of select="$nfs"/>|<xsl:value-of select="count($refs/e:i)"/>|<xsl:value-of select="count($nfs/e:nf)"/>|<xsl:value-of select="count(key('nf','SUM(&#170;2&#170;7:&#170;3&#170;7)',$nfs))"/>|<xsl:value-of select="count($nfs/e:nf[.='SUM(&#170;2&#170;7:&#170;3&#170;7)'])"/>
+  <xsl:apply-templates/></a>
+ </xsl:template>
 
  <xsl:template match="e:r/e:c">
   <xsl:variable name="row" select="../@r"/>
@@ -17,9 +29,11 @@
   <c>
    <xsl:apply-templates select="@*"/>
    <xsl:if test="e:f">
-    <xsl:attribute name="f"></xsl:attribute>
+    <xsl:message><xsl:value-of select="e:f"/></xsl:message>
+    <xsl:attribute name="fi"><xsl:value-of select="key('nf',e:nf/text(),$nfs)/@i"/></xsl:attribute>
    </xsl:if>
   <xsl:if test="$reffed"><xsl:copy-of select="$reffed"/></xsl:if>
+   <xsl:apply-templates select="node()"/>
   </c>
  </xsl:template>