Changeset 5ac9ea9


Ignore:
Timestamp:
13/04/2012 18:42:32 (10 years ago)
Author:
Eric van der Vlist <vdv@dyomedea.com>
Branches:
master
Children:
01a6690
Parents:
0e7bdd1
git-author:
Eric van der Vlist <vdv@dyomedea.com> (13/04/2012 18:42:32)
git-committer:
Eric van der Vlist <vdv@dyomedea.com> (13/04/2012 18:42:32)
Message:

Packaging resources that have not been rewritten...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • archiver/pipelines/actions/package-archive.xpl

    r0e7bdd1 r5ac9ea9  
    203203              <xsl:apply-templates select="/archive/response" mode="warc"/> 
    204204              <CRLF/> 
    205                
     205 
    206206            </xsl:variable> 
    207207            <document xsl:version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string" content-type="text/plain"> 
     
    226226      <p:input name="data" href="#document#xpointer(/archive/response/document)"/> 
    227227    </p:processor> 
    228      
     228 
     229    <p:choose href="current()"> 
     230      <p:when test="/archive/@href-rewritten"> 
     231        <p:processor name="oxf:identity"> 
     232          <p:input name="data"> 
     233            <none/> 
     234          </p:input> 
     235          <p:output name="data" id="file" debug="file"/> 
     236        </p:processor> 
     237      </p:when> 
     238      <p:otherwise> 
     239        <!-- Store a copy of the orginal version --> 
     240        <p:processor name="oxf:file-serializer"> 
     241          <p:input name="config"> 
     242            <config> 
     243              <scope>request</scope> 
     244            </config> 
     245          </p:input> 
     246          <p:input name="data" href="#document#xpointer(/archive/response/document)"/> 
     247          <p:output name="data" id="file" debug="file"/> 
     248        </p:processor> 
     249      </p:otherwise> 
     250    </p:choose> 
     251 
     252 
     253 
    229254    <p:processor name="oxf:identity"> 
    230       <p:input name="data" href="current()"/> 
     255      <p:input name="data" href="aggregate('file', current(), #file)"/> 
    231256      <p:output name="data" ref="files"/> 
    232257    </p:processor> 
     
    236261 
    237262  <p:processor name="oxf:null-serializer"> 
    238     <p:input name="data" href="#files"/> 
     263    <p:input name="data" href="#files" debug="files"/> 
    239264  </p:processor> 
    240265 
    241266  <p:processor name="oxf:zip"> 
    242     <p:input name="data" transform="oxf:xslt" href="#warc"> 
     267    <p:input name="data" transform="oxf:unsafe-xslt" href="aggregate('root', #warc, #files)"> 
    243268      <files xsl:version="2.0" file-name="archive.zip"> 
    244269        <file name="archive.warc"> 
    245           <xsl:value-of select="/url"/> 
     270          <xsl:value-of select="/root/url"/> 
    246271        </file> 
     272        <xsl:for-each select="/root/files/file[url]"> 
     273          <xsl:variable name="tokens" select="tokenize(archive/@url, '/')"/> 
     274          <xsl:variable name="last-token" select="$tokens[last()]"/> 
     275          <xsl:variable name="tokens2" select="tokenize($last-token, '\.')"/> 
     276          <xsl:variable name="extension" select="$tokens2[last()]"/> 
     277          <file name="rewritten/{saxon:string-to-hexBinary(substring(archive/@url, 1, string-length(archive/@url) - string-length($extension) - 1), 'utf-8')}.{$extension}"> 
     278            <xsl:value-of select="url"/> 
     279          </file> 
     280        </xsl:for-each> 
    247281      </files> 
    248282    </p:input> 
Note: See TracChangeset for help on using the changeset viewer.