First version that can produce a packaged archive.

This commit is contained in:
Eric van der Vlist 2012-04-13 19:08:04 +02:00
parent 5ac9ea90bb
commit 01a66903f3
4 changed files with 69 additions and 23 deletions

View File

@ -132,6 +132,16 @@ for $a in /queue/action where $a/@uuid = $(uuid) return
<p:output name="links" id="links"/>
</p:processor>
<!-- It's a hack so that the document is not submitted as text through the xforms:submit processor... -->
<p:processor name="oxf:xslt">
<p:input name="config">
<document xsl:version="2.0">
<xsl:copy-of select="/"/>
</document>
</p:input>
<p:input name="data" href="#rewritten"/>
<p:output name="data" id="rewritten-embedded"/>
</p:processor>
<!-- Store the rewritten document in the database -->
<p:processor name="oxf:pipeline">
@ -147,7 +157,7 @@ for $a in /queue/action where $a/@uuid = $(uuid) return
<type>document</type>
</config>
</p:input>
<p:input name="param" href="#rewritten"/>
<p:input name="param" href="#rewritten-embedded"/>
<p:output name="data" id="response3"/>
</p:processor>
<p:processor name="oxf:null-serializer">

View File

@ -23,6 +23,7 @@
<url>
<xsl:value-of select="/*"/>
</url>
<content-type>text/css</content-type>
<mode>text</mode>
</config>
</p:input>
@ -97,18 +98,9 @@
</xsl:template>
</xsl:stylesheet>
</p:input>
<p:output name="data" id="rewritten-local" debug="rewritten"/>
<p:output name="data" ref="rewritten" debug="rewritten"/>
</p:processor>
<!-- It's a hack so that the document is not submitted as text through the xforms:submit processor... -->
<p:processor name="oxf:xslt">
<p:input name="config">
<document xsl:version="2.0">
<xsl:copy-of select="/"/>
</document>
</p:input>
<p:input name="data" href="#rewritten-local"/>
<p:output name="data" ref="rewritten"/>
</p:processor>
</p:config>

View File

@ -105,7 +105,19 @@
</xsl:template>
</xsl:stylesheet>
</p:input>
<p:output name="data" ref="rewritten" debug="rewritten"/>
<p:output name="data" id="html-rewritten" debug="rewritten"/>
</p:processor>
<p:processor name="oxf:xml-converter">
<p:input name="config">
<config>
<content-type>application/xml</content-type>
<encoding>utf-8</encoding>
<version>1.0</version>
</config>
</p:input>
<p:input name="data" href="#html-rewritten"/>
<p:output name="data" ref="rewritten"/>
</p:processor>
</p:config>

View File

@ -228,10 +228,32 @@ conformsTo:
<p:choose href="current()">
<p:when test="/archive/@href-rewritten">
<p:processor name="oxf:identity">
<p:input name="data">
<none/>
<!-- Read the rewritten document -->
<p:processor name="oxf:pipeline">
<p:input name="config" href="/data-access.xpl"/>
<p:input name="data" transform="oxf:xslt" href="aggregate('root', #data, current())">
<config xsl:version="2.0">
<relpath>
<xsl:value-of select="/root/action/@directory"/>
<xsl:value-of select="/root/archive/@href-rewritten"/>
</relpath>
<operation>read</operation>
<type>document</type>
</config>
</p:input>
<p:input name="param">
<empty/>
</p:input>
<p:output name="data" id="rewritten" debug="rewritten"/>
</p:processor>
<!-- Store this document -->
<p:processor name="oxf:file-serializer">
<p:input name="config">
<config>
<scope>request</scope>
</config>
</p:input>
<p:input name="data" href="#rewritten#xpointer(/document/document)"/>
<p:output name="data" id="file" debug="file"/>
</p:processor>
</p:when>
@ -270,13 +292,23 @@ conformsTo:
<xsl:value-of select="/root/url"/>
</file>
<xsl:for-each select="/root/files/file[url]">
<xsl:variable name="tokens" select="tokenize(archive/@url, '/')"/>
<xsl:variable name="last-token" select="$tokens[last()]"/>
<xsl:variable name="tokens2" select="tokenize($last-token, '\.')"/>
<xsl:variable name="extension" select="$tokens2[last()]"/>
<file name="rewritten/{saxon:string-to-hexBinary(substring(archive/@url, 1, string-length(archive/@url) - string-length($extension) - 1), 'utf-8')}.{$extension}">
<xsl:value-of select="url"/>
</file>
<xsl:choose>
<xsl:when test="position()=1">
<!-- TODO: support non HTML documents... -->
<file name="rewritten/index.html">
<xsl:value-of select="url"/>
</file>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="tokens" select="tokenize(archive/@url, '/')"/>
<xsl:variable name="last-token" select="$tokens[last()]"/>
<xsl:variable name="tokens2" select="tokenize($last-token, '\.')"/>
<xsl:variable name="extension" select="$tokens2[last()]"/>
<file name="rewritten/{saxon:string-to-hexBinary(substring(archive/@url, 1, string-length(archive/@url) - string-length($extension) - 1), 'utf-8')}.{$extension}">
<xsl:value-of select="url"/>
</file>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</files>
</p:input>