view html.xsl @ 19:9b1b169dc8db

use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
author Henry S. Thompson <ht@markup.co.uk>
date Tue, 04 Apr 2017 17:45:50 +0100
parents 2bbd067529b6
children 104ef815b0b0
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:strip-space elements="e:a"/>
 <xsl:output omit-xml-declaration="yes"/>
 
 <xsl:template match="/">
  <html>
   <head>
    <style>
       body {font-family: 'DejaVu Sans Mono' , monospace}
       td {padding: 0}
       .e {color: red}
       .formula {font-style: italic}
       .reffed {border: solid 1px black}
    </style>
   </head>
   <body>
    <xsl:apply-templates/>
   </body>
  </html>
 </xsl:template>

 <xsl:template match="e:a">
  <table>
   <thead/>
   <tbody><xsl:apply-templates/></tbody>
  </table>
 </xsl:template>
 
 <xsl:template match="e:r">
  <tr><xsl:apply-templates/></tr>
  <xsl:text>&#10;</xsl:text>
 </xsl:template>
 
 <xsl:template match="e:c">
  <td>
   <xsl:choose>
    <xsl:when test="text()">
     <xsl:attribute name="class">
      <xsl:value-of select="(.,
                             if (@f) then 'formula' else (),
                             if (@r) then 'reffed' else ())"/>
     </xsl:attribute>
     <xsl:value-of select="."/></xsl:when>
    <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
   </xsl:choose>
   </td>
 </xsl:template>
</xsl:stylesheet>