comparison html.xsl @ 15:e767bef35bb9

default to ascii, but accept html.xsl for pretty
author Henry S. Thompson <ht@markup.co.uk>
date Mon, 03 Apr 2017 16:02:10 +0100
parents
children 2bbd067529b6
comparison
equal deleted inserted replaced
14:261e439a19fb 15:e767bef35bb9
1 <?xml version='1.0'?>
2 <!DOCTYPE doc SYSTEM "../../../lib/xml/xsl.dtd" >
3 <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">
4 <xsl:strip-space elements="e:a"/>
5 <xsl:output omit-xml-declaration="yes"/>
6
7 <xsl:template match="/">
8 <html>
9 <head>
10 <style>
11 body {font-family: 'DejaVu Sans Mono' , monospace}
12 .e {color: red}
13 .formula {font-style: italic}
14 </style>
15 </head>
16 <body>
17 <xsl:apply-templates/>
18 </body>
19 </html>
20 </xsl:template>
21
22 <xsl:template match="e:a">
23 <table>
24 <thead/>
25 <tbody><xsl:apply-templates/></tbody>
26 </table>
27 </xsl:template>
28
29 <xsl:template match="e:r">
30 <tr><xsl:apply-templates/></tr>
31 <xsl:text>&#10;</xsl:text>
32 </xsl:template>
33
34 <xsl:template match="e:c">
35 <td>
36 <xsl:choose>
37 <xsl:when test="text()">
38 <xsl:attribute name="class">
39 <xsl:value-of select="(.,if (@f) then 'formula' else ())"/>
40 </xsl:attribute>
41 <xsl:value-of select="."/></xsl:when>
42 <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
43 </xsl:choose>
44 </td>
45 </xsl:template>
46 </xsl:stylesheet>