Re: Renaming a zip filename with a value from a zip manifest

Hi Julie,

you can evaluate p:with-option in the context of another step/port:

<p:with-option name="href" select="concat('file:/E:/file-path-here/', 'done/', /c:zip-manifest/@s:new-zipname)">
   <p:pipe port="result" step="build-zip-manifests"/>
</p:with-option>

Gerrit

On 15.05.2024 22:39, Julie Blair wrote:
> Hi all,
> 
> I have a fairly complex (to me!) pipeline in version 1.0 that has the following steps:
> 
> Unzips a zipfile with multiple XML files and loops through these files to check and potentially change links within the xml to images and PDFs also included in the zipfile – essentially updating the file naming of images and PDFs (as well as links within the XML to these files) to conform to business needs. The XML is also run through an XSLT to finish off remediations that are needed. Finally the files are zipped back up – and here lies the problem, how do I specify the zip filename to be saved here. I want to change it to a value concatenated from various elements in the XML files inside the zip. I’m generating the value within the build-zip-manifests step. I’m just not sure how to access this value once I’m in the store zip step.
> 
> Below is a snippet of the pipeline where I’m creating the zip manifest and trying to store the zip via a defined value from the manifest:
> 
> <p:xslt name="build-zip-manifests">
> 
>      <p:input port="source">
> 
>          <p:pipe port="result" step="chk-graphics"/>
> 
>      </p:input>
> 
>      <p:input port="stylesheet">
> 
>          <p:document href="zip-manifests.xsl"/>
> 
>      </p:input>
> 
>      <p:input port="parameters">
> 
>          <p:empty/>
> 
>      </p:input>
> 
> </p:xslt>
> 
> <p:store>
> 
>      <p:with-option name="href" select="concat('man',$zipName,'.xml')"/>
> 
> </p:store>
> 
> <p:identity>
> 
>      <p:input port="source">
> 
>          <p:pipe port="result" step="build-zip-manifests"/>
> 
>      </p:input>
> 
> </p:identity>
> 
> <!-- update zip -->
> 
> <p:sink/>
> 
> <pxp:zip name="zip-update">
> 
>      <p:input port="source">
> 
>          <p:empty/>
> 
>      </p:input>
> 
>      <p:input port="manifest">
> 
>          <p:pipe port="result" step="build-zip-manifests"/>
> 
>      </p:input>
> 
>     <p:with-option name="href" select="concat('file:/E:/file-path-here/', 'done/', *//@s:new-zipname*)"/>
> 
>      <p:with-option name="command" select="'create'"/>
> 
>      <p:with-option name="compression-method" select="'deflated'"/>
> 
>      <p:with-option name="compression-level" select="'default'"/>
> 
> </pxp:zip>
> 
> <p:sink/>
> 
> The value *//@s:new-zipname *is from the generated manifest file in the previous step – a snippet is below of the output:
> 
> <c:zip-manifest xmlns:c=http://www.w3.org/ns/xproc-step <http://www.w3.org/ns/xproc-step> xmlns:s=http://yournamspace.com <http://yournamspace.com> s:manifest-type="create" *s:new-zipname="TLA_2017_1_1.zip"*>
> 
> How do I traverse back to get this value and place it in the store <p:with-option> @href.
> 
> Thanks,
> 
> Julie
> 

-- 
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsieke@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt

Received on Wednesday, 15 May 2024 20:52:08 UTC