Mercurial > hg > ooxml
diff rect.xsl @ 24:87e0d620deea
switch to elements from attributes and default namespace
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Thu, 06 Apr 2017 17:24:30 +0100 |
parents | 104ef815b0b0 |
children | d2ca3ea1f5ae |
line wrap: on
line diff
--- a/rect.xsl Thu Apr 06 16:47:53 2017 +0100 +++ b/rect.xsl Thu Apr 06 17:24:30 2017 +0100 @@ -1,11 +1,11 @@ <?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" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xpf="http://www.w3.org/2005/xpath-functions"> +<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" xmlns="http://markup.co.uk/excel" xmlns:xpf="http://www.w3.org/2005/xpath-functions"> <xsl:strip-space elements="s:sheetData"/> <xsl:variable name="refs" select="collection()[2]/*"/> - <xsl:key name="ref" match="e:ref" use="tokenize(@r)"/> + <xsl:key name="ref" match="e:ref" use="e:s"/> <xsl:function name="e:a2n" as="xs:integer"> <!-- Convert an alphabetic excel column 'index' into a number, @@ -45,10 +45,10 @@ <xsl:variable name="width" select="1+e:a2n($dims//xpf:group[@nr='3'])-e:a2n($dims//xpf:group[@nr='1'])"/> <!-- Brute force! --> <xsl:variable name="sheet" select="."/> - <e:a> + <a> <xsl:text> </xsl:text> <xsl:for-each select="(1 to $height)"><xsl:variable name="row" select="."/> - <e:r r="{$row}"> + <r r="{$row}"> <xsl:variable select="$sheet/s:row[@r=$row]/s:c" name="cells"/> <xsl:if test="$cells/*"> <xsl:for-each select="(1 to $width)"> @@ -56,15 +56,15 @@ <xsl:variable name="r" select="concat(e:n2a($col),string($row))"/> <xsl:variable name="c" select="$cells[@r=$r]"/> <xsl:variable name="reffed" select="key('ref',$r,$refs)"/> - <e:c c="{$col}"> + <c c="{$col}"> <xsl:if test="$c/s:f"><xsl:attribute name="f">1</xsl:attribute></xsl:if> - <xsl:if test="$reffed"><xsl:attribute name="r"><xsl:value-of select="$reffed/@c"/></xsl:attribute></xsl:if> - <xsl:if test="$c/*"><xsl:value-of select="substring($c/@e:type,1,1)"/></xsl:if> - </e:c> + <xsl:if test="$c/*"><t><xsl:value-of select="substring($c/@e:type,1,1)"/></t></xsl:if> + <xsl:if test="$reffed"><xsl:for-each select="$reffed/@c"><r><xsl:value-of select="."/></r></xsl:for-each></xsl:if> + </c> </xsl:for-each></xsl:if> - </e:r> + </r> <xsl:text> </xsl:text></xsl:for-each> - </e:a> + </a> </xsl:if> </xsl:template> </xsl:stylesheet>