Commit 61651337 authored by oyvind Gjesdal's avatar oyvind Gjesdal
Browse files

tillat zip, prøv unix sti med trippel

parent 2143a72f
......@@ -28,11 +28,11 @@
</root>
-->
<xsl:output indent="yes" method="xml"/>
<xsl:param name="path-restriction" as="xs:string?" select="'/ok'"/>
<xsl:param name="path-restriction" as="xs:string?" select="'excel'"/>
<xsl:param name="path"
select="'../../input/variant'"/>
select="'/home/oyvind/repos/datasets/input/dataset-termportalen/input/excel'"/>
<xsl:param name="is-folder" select="true()" as="xs:boolean"/>
<xsl:param name="starting-row" select="0" as="xs:integer"/>
<xsl:param name="starting-row" select="1" as="xs:integer"/>
<xsl:import href="xsl-lib/functions/OOXML/spreadsheetML.xsl"/>
<xsl:key name="element-name" match="name" use="@r"/>
......@@ -43,9 +43,11 @@
<xsl:template name="xlsx2xml">
<xsl:param name="xlsx-path" as="xs:string"/>
<xsl:message select="$xlsx-path"/>
<xsl:variable name="worksheets" select="collection($xlsx-path || '?select=*sheet*xml;recurse=yes')" as="document-node()*"/>
<xsl:variable name="shared-strings" select="collection($xlsx-path || '?select=*sharedStrings.xml;recurse=yes')" as="document-node()?"/>
<xsl:variable name="styles" select="collection($xlsx-path || '?select=*styles.xml;recurse=yes')" as="document-node()*"/>
<xsl:variable name="worksheets" select="collection($xlsx-path || '?select=*sheet*xml' )" as="document-node()+"/>
<xsl:variable name="shared-strings" select="collection($xlsx-path || '?select=*sharedStrings.xml;recurse=yes')" as="document-node()+"/>
<xsl:variable name="styles" select="collection($xlsx-path || '?select=*styles.xml;recurse=yes')" as="document-node()+"/>
<root>
<xsl:for-each select="$worksheets">
<!-- construct one element names tables for each workbook sheet, which is tunneled to subcontext-->
......@@ -81,14 +83,15 @@
<xsl:message select="'/', $path,$is-folder"></xsl:message>
<xsl:choose>
<xsl:when test="$is-folder">
<xsl:for-each select="collection($path||'?select=*xlsx;metadata=yes')">
<xsl:variable name="this.xslx" select="map:get(.,'name')" as="xs:string"/>
<xsl:message select="$this.xslx"/>
<xsl:for-each select="collection($path||'?matches=(xlsx|zip)$;metadata=yes;recurse=yes')">
<xsl:variable name="this.xslx" select="replace(map:get(.,'name'),'file:/([^/])','file:///$1')" as="xs:string"/>
<xsl:message select="string-join(map:keys(.), ' ') || $this.xslx"/>
<xsl:if test="not($is-folder) or not($path-restriction) or contains($this.xslx,$path-restriction)">
<xsl:result-document method="xml" indent="yes" href="{replace($this.xslx,'xlsx$','xml','i')}">
<xsl:result-document method="xml" indent="yes" href="../result/{replace($this.xslx,'(xlsx|zip)$','xml','i')}">
<xsl:call-template name="xlsx2xml">
<xsl:with-param name="xlsx-path" select="$this.xslx"/>
</xsl:call-template>
</xsl:call-template>
</xsl:result-document>
</xsl:if>
</xsl:for-each>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment