changeset 17:a874f2a81ed2

default vis pipeline to raw xml, start extracting refs
author Henry S. Thompson <ht@markup.co.uk>
date Tue, 04 Apr 2017 15:30:04 +0100
parents 2bbd067529b6
children 16bba7a0d0bd
files refs.xsl visualise.xpl
diffstat 2 files changed, 34 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/refs.xsl	Tue Apr 04 15:30:04 2017 +0100
@@ -0,0 +1,15 @@
+<?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" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
+  <xsl:variable name="pat1">("[^"]*")|(\{[^}]+})|(,)|([^=\-+*/();:,.$&lt;>^!]+(?:\.[^=\-+*/();:,.$&lt;>^!]+)*\()|([)])|(^=|\()|((?:'[^']+')|(?:\[[0-9]+\][^!]*))|(\$?[A-Z]+\$?[0-9]+)|([a-zA-Z_\\][a-zA-Z0-9._]*)|(.)</xsl:variable>
+ <xsl:param name="pat" select="$pat1"/>
+
+ <xsl:template match="/">
+  <e:refs><xsl:apply-templates select="//s:f"/></e:refs>
+ </xsl:template>
+ 
+ <xsl:template match="s:f">
+  <xsl:variable name="tokens" select="analyze-string(.,$pat)"/>
+  <xsl:copy-of select="$tokens"/>
+ </xsl:template>
+</xsl:stylesheet>
--- a/visualise.xpl	Mon Apr 03 19:22:03 2017 +0100
+++ b/visualise.xpl	Tue Apr 04 15:30:04 2017 +0100
@@ -13,7 +13,7 @@
   </p:documentation>
  </p:option>
  
- <p:option name="format" select="'ascii.xsl'">
+ <p:option name="format">
   <p:documentation xmlns="http://www.w3.org/1999/xhtml">
    <div>If supplied, then use as stylesheet (located relative to elabDir)</div>
   </p:documentation>
@@ -46,16 +46,22 @@
   </p:input>
  </p:xslt>
  
- <p:load name="ss3">
-  <p:with-option name="href" select="concat($elabDir,'/',$format)"/>
- </p:load>
- 
- <p:xslt name="asc">
-   <p:input port="source">
-    <p:pipe step="rect" port="result"/>
-   </p:input>
-  <p:input port="stylesheet">
-   <p:pipe step="ss3" port="result"/>
-  </p:input>
- </p:xslt>
+ <p:choose> 
+  <p:when test="p:value-available('format')">
+   <p:load name="ss3">
+    <p:with-option name="href" select="concat($elabDir,'/',$format)"/>
+   </p:load>
+   <p:xslt name="asc">
+    <p:input port="source">
+     <p:pipe step="rect" port="result"/>
+    </p:input>
+    <p:input port="stylesheet">
+     <p:pipe step="ss3" port="result"/>
+    </p:input>
+   </p:xslt>
+  </p:when>
+  <p:otherwise>
+   <p:identity/>
+  </p:otherwise>
+ </p:choose>
 </p:pipeline>