view shared.xsl @ 53:8000dbed09df

better, now failing on [1]\!'AES,DIVIDEND'
author Henry S. Thompson <ht@markup.co.uk>
date Tue, 16 May 2017 19:09:03 +0100
parents 5d9806f90896
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 e xf" xmlns="http://markup.co.uk/excel" xmlns:xf="http://www.w3.org/2005/xpath-functions">
 
 <xsl:template match="/">
  <masters><xsl:apply-templates select="/s:worksheet/s:sheetData"/></masters>
 </xsl:template>
 
 <xsl:template match="s:sheetData">
  <xsl:variable select="s:row/s:c/s:f[@si]" name="sfs"/>
  <xsl:variable name="indices" select="distinct-values(for $sf in $sfs/@si return string($sf))">
   <!-- s:f/@si values -->
  </xsl:variable>
  
  <xsl:for-each select="$indices">
   <xsl:variable name="i" select="."/>
   <xsl:variable name="sf" select="($sfs[@si=$i])[1]"/>
   <master si="{$i}" r="{$sf/../@r}"><xsl:value-of select="$sf"/></master>
  </xsl:for-each>
 </xsl:template>
</xsl:stylesheet>