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

Thank you, Gerrit! This is perfect (and elegant).

-----Original Message-----
From: Imsieke, Gerrit, le-tex <gerrit.imsieke@le-tex.de>
Sent: Wednesday, May 15, 2024 1:52 PM
To: xproc-dev@w3.org
Subject: Re: Renaming a zip filename with a value from a zip manifest

 [ EXTERNAL ]

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=https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F
> %2Fwww.w3.org%2Fns%2Fxproc-step&data=05%7C02%7CJulie.Blair%40sagepub.c
> om%7Cfa2ebab8779a4b0c6b8508dc7520f3a6%7C866b3abd7515461abdb412b4a1857f
> 04%7C0%7C0%7C638514031601879418%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj
> AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdat
> a=4sbs816HLAa4ZaGtLxGWvnZTJiN5TgE27DdE%2FuAPSOA%3D&reserved=0
> <http://www/.
> w3.org%2Fns%2Fxproc-step&data=05%7C02%7CJulie.Blair%40sagepub.com%7Cfa
> 2ebab8779a4b0c6b8508dc7520f3a6%7C866b3abd7515461abdb412b4a1857f04%7C0%
> 7C0%7C638514031601889630%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiL
> CJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=gldjE
> 38Xk5rlR%2FCRRswVRqBZsBTrincRjhacE%2F3VI7M%3D&reserved=0>
> xmlns:s=https://nam12.safelinks.protection.outlook.com/?url=http%3A%2F
> %2Fyournamspace.com%2F&data=05%7C02%7CJulie.Blair%40sagepub.com%7Cfa2e
> bab8779a4b0c6b8508dc7520f3a6%7C866b3abd7515461abdb412b4a1857f04%7C0%7C
> 0%7C638514031601894995%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJ
> QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=%2F4wkt
> 7CpIYoFGbVSxmrLhEaFLSYZaBhG%2F%2FXJioN3blY%3D&reserved=0
> <http://your/
> namspace.com%2F&data=05%7C02%7CJulie.Blair%40sagepub.com%7Cfa2ebab8779
> a4b0c6b8508dc7520f3a6%7C866b3abd7515461abdb412b4a1857f04%7C0%7C0%7C638
> 514031601899835%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2
> luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=8xAqnALEne%2Fv
> pk06pfVE1tbt63wcZi6cUcLaeynhdh0%3D&reserved=0>
> 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 21:51:50 UTC