I've got an xml with multiple entries for file links. The list could include one entry or up to ten, and the target won't be always in the same position. I need to use the link that's name ends in "-all.pdf" to download my file. I am trying to store the url as a Private Data Key. All the values are either the same (<type>, <units>) or unique to the order (<name>,<url>, <checksum>, etc.).
I know how to filter when searching for a specific value (/MxJdf4/job/article/additional-files/additionalFiles[sizeInBytes=3385008]/url).
Is there a way in the Metadata > Build Location Path to search for a partial file name (/url=%-all.pdf)?
Here is a sample list of URL's. In this example I'm trying to get "<url>https://url1.com/job966098-3-all.pdf</url>":
<additional-files>
<additionalFiles>
<type>0</type>
<name>job966098-3.pdf</name>
<url>https://url1.com/job966098-3.pdf</url>
<checksum>eaca23fdfa58ba359dfd0d59c1bdbc13</checksum>
<sizeInBytes>6104367</sizeInBytes>
<trimBox>
<longEdge>228.60000610351562</longEdge>
<shortEdge>152.39999389648438</shortEdge>
<units>1</units>
</trimBox>
</additionalFiles>
<additionalFiles>
<type>0</type>
<name>job966098-3-cover.pdf</name>
<url>https://url1.com/job966098-3-cover.pdf</url>
<checksum>fe56552eb9243cb32001c89c4db7f785</checksum>
<sizeInBytes>236682</sizeInBytes>
<trimBox>
<longEdge>304.79998779296875</longEdge>
<shortEdge>228.60000610351562</shortEdge>
<units>1</units>
</trimBox>
</additionalFiles>
<additionalFiles>
<type>0</type>
<name>job966098-3-all.pdf</name>
<url>https://url1.com/job966098-3-all.pdf</url>
<checksum>593bf192b7fd985b69d116768e588f10</checksum>
<sizeInBytes>5714732</sizeInBytes>
<trimBox>
<longEdge>304.79998779296875</longEdge>
<shortEdge>228.60000610351562</shortEdge>
<units>1</units>
</trimBox>
</additionalFiles>
</additional-files>
Searching for link in XML/JDF file [SOLVED]
Searching for link in XML/JDF file [SOLVED]
Last edited by wkopp on Fri Feb 17, 2023 5:14 pm, edited 1 time in total.
Re: Searching for link in XML/JDF file
Try this:
Loic
Code: Select all
/additional-files/additionalFiles/url[contains(text(), '-all.pdf')]
Re: Searching for link in XML/JDF file
Excellent! That did it. Thank you so much!loicaigon wrote: ↑Fri Feb 17, 2023 9:17 am Try this:LoicCode: Select all
/additional-files/additionalFiles/url[contains(text(), '-all.pdf')]
Very helpful piece of code. Is there a reference somewhere for this kind of thing?
Re: Searching for link in XML/JDF file [SOLVED]
Glad it helped, the command is part of XPATH API which includes the contains method I have used.
https://www.w3schools.com/xml/xsl_functions.asp
Long history of fail and learn with XSLT talking here
https://www.w3schools.com/xml/xsl_functions.asp
Long history of fail and learn with XSLT talking here