Mercurial > hg > ooxml
comparison html.xsl @ 34:93fd0d532754
fix bug in refs wrt e.g. [1]!.SGX,
adapt html and ascii to new-format refs,
move a2n and n2a into separate files for re-use
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Wed, 12 Apr 2017 21:35:04 +0100 |
parents | 104ef815b0b0 |
children | 5b2333e59d91 |
comparison
equal
deleted
inserted
replaced
33:27bffc66ce10 | 34:93fd0d532754 |
---|---|
2 <!DOCTYPE doc SYSTEM "../../../lib/xml/xsl.dtd" > | 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"> | 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"/> | 4 <xsl:strip-space elements="e:a"/> |
5 <xsl:output omit-xml-declaration="yes"/> | 5 <xsl:output omit-xml-declaration="yes"/> |
6 | 6 |
7 <xsl:include href="n2a.xsl"/> | |
8 | |
7 <xsl:template match="/"> | 9 <xsl:template match="/"> |
8 <html> | 10 <html> |
9 <head> | 11 <head> |
12 <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> | |
10 <style> | 13 <style> |
11 body {font-family: 'DejaVu Sans Mono' , monospace} | 14 body {font-family: 'DejaVu Sans Mono' , monospace} |
12 td {padding: 0} | 15 td {padding: 0} |
13 .e {color: red} | 16 .e {color: red} |
14 .formula {font-style: italic} | 17 .formula {font-style: italic} |
15 .reffed {border: solid 1px black} | 18 .reffed {border: solid 1px black} |
19 table {table-layout: fixed} | |
20 th {width: 1en} | |
16 </style> | 21 </style> |
17 </head> | 22 </head> |
18 <body> | 23 <body> |
19 <xsl:apply-templates/> | 24 <xsl:apply-templates/> |
20 </body> | 25 </body> |
21 </html> | 26 </html> |
22 </xsl:template> | 27 </xsl:template> |
23 | 28 |
24 <xsl:template match="e:a"> | 29 <xsl:template match="e:a"> |
30 <xsl:variable name="n" select="count(e:r[1]/e:c)"/> | |
25 <table> | 31 <table> |
26 <thead/> | 32 <thead> |
33 <tr> | |
34 <xsl:for-each select="1 to $n"> | |
35 <th/> | |
36 </xsl:for-each> | |
37 </tr> | |
38 </thead> | |
27 <tbody><xsl:apply-templates/></tbody> | 39 <tbody><xsl:apply-templates/></tbody> |
28 </table> | 40 </table> |
29 </xsl:template> | 41 </xsl:template> |
30 | 42 |
31 <xsl:template match="e:r"> | 43 <xsl:template match="e:r"> |
34 </xsl:template> | 46 </xsl:template> |
35 | 47 |
36 <xsl:template match="e:c"> | 48 <xsl:template match="e:c"> |
37 <td> | 49 <td> |
38 <xsl:choose> | 50 <xsl:choose> |
39 <xsl:when test="text()"> | 51 <xsl:when test="e:t"> |
40 <xsl:attribute name="class"> | 52 <xsl:attribute name="class"> |
41 <xsl:value-of select="(., | 53 <xsl:value-of select="(e:t, |
42 if (@f) then 'formula' else (), | 54 if (@f) then 'formula' else (), |
43 if (@r) then 'reffed' else ())"/> | 55 if (e:r) then 'reffed' else ())"/> |
44 </xsl:attribute> | 56 </xsl:attribute> |
45 <xsl:if test="@r"><xsl:attribute name="title"><xsl:value-of select="@r"/></xsl:attribute></xsl:if> | 57 <xsl:attribute name="title"><xsl:value-of select="e:n2a(@c)"/><xsl:value-of select="../@r"/><xsl:if test="e:r">: <xsl:value-of select="e:r"/></xsl:if></xsl:attribute> |
46 <xsl:value-of select="."/></xsl:when> | 58 <xsl:value-of select="if (e:t/@c) then e:t/@c else e:t"/></xsl:when> |
47 <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise> | 59 <xsl:otherwise></xsl:otherwise> |
48 </xsl:choose> | 60 </xsl:choose> |
49 </td> | 61 </td> |
50 </xsl:template> | 62 </xsl:template> |
51 </xsl:stylesheet> | 63 </xsl:stylesheet> |