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:output name="links" id="links"/>
</p:processor> </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 --> <!-- Store the rewritten document in the database -->
<p:processor name="oxf:pipeline"> <p:processor name="oxf:pipeline">
@ -147,7 +157,7 @@ for $a in /queue/action where $a/@uuid = $(uuid) return
<type>document</type> <type>document</type>
</config> </config>
</p:input> </p:input>
<p:input name="param" href="#rewritten"/> <p:input name="param" href="#rewritten-embedded"/>
<p:output name="data" id="response3"/> <p:output name="data" id="response3"/>
</p:processor> </p:processor>
<p:processor name="oxf:null-serializer"> <p:processor name="oxf:null-serializer">

View File

@ -23,6 +23,7 @@
<url> <url>
<xsl:value-of select="/*"/> <xsl:value-of select="/*"/>
</url> </url>
<content-type>text/css</content-type>
<mode>text</mode> <mode>text</mode>
</config> </config>
</p:input> </p:input>
@ -97,18 +98,9 @@
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>
</p:input> </p:input>
<p:output name="data" id="rewritten-local" debug="rewritten"/> <p:output name="data" ref="rewritten" debug="rewritten"/>
</p:processor> </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> </p:config>

View File

@ -105,7 +105,19 @@
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>
</p:input> </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:processor>
</p:config> </p:config>

View File

@ -228,10 +228,32 @@ conformsTo:
<p:choose href="current()"> <p:choose href="current()">
<p:when test="/archive/@href-rewritten"> <p:when test="/archive/@href-rewritten">
<p:processor name="oxf:identity"> <!-- Read the rewritten document -->
<p:input name="data"> <p:processor name="oxf:pipeline">
<none/> <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>
<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:output name="data" id="file" debug="file"/>
</p:processor> </p:processor>
</p:when> </p:when>
@ -270,13 +292,23 @@ conformsTo:
<xsl:value-of select="/root/url"/> <xsl:value-of select="/root/url"/>
</file> </file>
<xsl:for-each select="/root/files/file[url]"> <xsl:for-each select="/root/files/file[url]">
<xsl:variable name="tokens" select="tokenize(archive/@url, '/')"/> <xsl:choose>
<xsl:variable name="last-token" select="$tokens[last()]"/> <xsl:when test="position()=1">
<xsl:variable name="tokens2" select="tokenize($last-token, '\.')"/> <!-- TODO: support non HTML documents... -->
<xsl:variable name="extension" select="$tokens2[last()]"/> <file name="rewritten/index.html">
<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"/>
<xsl:value-of select="url"/> </file>
</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> </xsl:for-each>
</files> </files>
</p:input> </p:input>