changeset 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 261e439a19fb
children 2bbd067529b6
files ascii.xsl html.xsl visualise.xpl
diffstat 3 files changed, 57 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ascii.xsl	Mon Apr 03 15:07:00 2017 +0100
+++ b/ascii.xsl	Mon Apr 03 16:02:10 2017 +0100
@@ -5,7 +5,10 @@
  <xsl:output omit-xml-declaration="yes"/>
 
  <xsl:template match="e:a">
-  <e:a><xsl:apply-templates select="*"/></e:a>
+  <e:a>
+   <xsl:text>&#10;</xsl:text>
+   <xsl:apply-templates select="*"/>
+  </e:a>
  </xsl:template>
  
  <xsl:template match="e:r">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/html.xsl	Mon Apr 03 16:02:10 2017 +0100
@@ -0,0 +1,46 @@
+<?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}
+       .e {color: red}
+       .formula {font-style: italic}
+    </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 ())"/>
+     </xsl:attribute>
+     <xsl:value-of select="."/></xsl:when>
+    <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
+   </xsl:choose>
+   </td>
+ </xsl:template>
+</xsl:stylesheet>
--- a/visualise.xpl	Mon Apr 03 15:07:00 2017 +0100
+++ b/visualise.xpl	Mon Apr 03 16:02:10 2017 +0100
@@ -1,7 +1,6 @@
 <?xml version='1.0'?>
 <!DOCTYPE p:pipeline SYSTEM "../../../WWW/XML/XProc/docs/schemas/xproc.dtd" >
 <p:pipeline xmlns:p="http://www.w3.org/ns/xproc" xmlns:x="http://www.w3.org/1999/xhtml" version="1.0" name="vis">
- <p:serialization method="text" port="result"/>
  
  <p:documentation xmlns="http://www.w3.org/1999/xhtml">
   <div>Run this e.g. as follows:
@@ -14,6 +13,12 @@
   </p:documentation>
  </p:option>
  
+ <p:option name="format" select="'ascii.xsl'">
+  <p:documentation xmlns="http://www.w3.org/1999/xhtml">
+   <div>If supplied, then use as stylesheet (located relative to elabDir)</div>
+  </p:documentation>
+ </p:option>
+ 
  <p:load name="ss1">
   <p:with-option name="href" select="concat($elabDir,'/format.xsl')"/>
  </p:load>
@@ -42,7 +47,7 @@
  </p:xslt>
  
  <p:load name="ss3">
-  <p:with-option name="href" select="concat($elabDir,'/ascii.xsl')"/>
+  <p:with-option name="href" select="concat($elabDir,'/',$format)"/>
  </p:load>
  
  <p:xslt name="asc">