We have xml data coming in that contains multiple entries. Each entry refers to a file path, stock, quantity etc.
What I'm trying to do is link this up with the JDF control to send straight to the press for outputting.
Can this be done from a single XML without splitting?
If it has to be split can anybody advise on best practice or example?
TIA
xml data & HP digital front end JDF Control
Re: xml data & HP digital front end JDF Control
You could probably do an XSLT transform to get separate files you can inject into your flow to run through the JDF configurator. I haven't done an XSLT transform that produces more than a single output file though, so I'm not sure if that's entirely possible. If not, then you'd probably have to write a script that would loop through your XML and output separate jobs for each record in the XML.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore
Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
Free Switch apps: open-automation @ Enfocus appstore
Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
Re: xml data & HP digital front end JDF Control
The XSLT transform configurator only supports XSLT 1.0. You need XSLT 2.0 to split your XML. Enfocus tipped me once to use Saxon for this (http://saxon.sourceforge.net), which I believe the configurator is included in Switch 13. I haven't tested with this configurator yet, I'm still running Switch 12u3.
Anyway, I use it this way:
Arguments (in my case):
XSL:
In my case I use it to split XML's with a unknown number of <file> nodes, so I can't use static pickup's.
Hope it helps,
Anyway, I use it this way:
Arguments (in my case):
Code: Select all
"%1" "D:\Scripts\Saxon\[Job.JobState].xsl" "%2\output.xml"
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="order/artikelen/artikel/bestanden/bestand">
<xsl:variable name="InputFile" select="base-uri()"/>
<xsl:variable name="OutputFile" select="tokenize($InputFile,'/')[last()]"/>
<xsl:variable name="OutputNoExt" select="substring-before($OutputFile,'.')"/>
<xsl:result-document href="{$OutputNoExt}_{format-number(position(),'000')}.xml" method="xml">
<xsl:copy-of select="current()/../.."/>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Hope it helps,
Re: xml data & HP digital front end JDF Control
Thanks for sharing your solution, sander. That is good information to know.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore
Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
Free Switch apps: open-automation @ Enfocus appstore
Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
Re: xml data & HP digital front end JDF Control
Thanks for the info.
-
- TOP CONTRIBUTOR
- Posts: 658
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Re: xml data & HP digital front end JDF Control
yes, Switch 13 has a Saxon configurator built-in
Re: xml data & HP digital front end JDF Control
The screenshots might be a little confusing, since I'm passing Switch variables %1 and %2 to Saxon.cmd, which catches these and use it otherwise.
The command I'm executing is Saxon.cmd, and this batch file holds this:
" >> "D:\Scripts\Saxon\SaxonError.log" 2>&1" is logging for batch files in Windows, you can ignore that.
Switch argument input:
So my batch file catches the input this way:
Batch %1 catches "%1"
Batch %2 catches "D:\Scripts\Saxon\[Job.JobState].xsl"
Batch %3 catches "%2\output.xml"
Hmm, too much information how my setup works! Let's go find a Mac solution, I'm not that experienced with Mac's but let's give it a try.
In your Command or Path you can try to specify your path to java with the Saxon jar:
path/to/java -jar path/to/saxon9he.jar
Your arguments need something like this:
-s:%1 -xsl:path/to/stylesheet.xsl -o:%2\output.xml
Notice the %2 at the end, it's not %3 like in my batch file!
Actually output.xml is not necessary since the XLS stylesheet does the file naming, however I couldn't get Saxon to work without specifying the output file.
I hope you can get it to work this way, else we need a way to 'translate' my Saxon.cmd to a Mac version, I hope some other forum member can join in to help us with that!
The command I'm executing is Saxon.cmd, and this batch file holds this:
Code: Select all
C:\ProgramData\Oracle\Java\javapath\java.exe -jar "D:\Scripts\Saxon\build\saxon9he.jar" -s:%1 -xsl:%2 -o:%3 >> "D:\Scripts\Saxon\SaxonError.log" 2>&1
Switch argument input:
Code: Select all
"%1" "D:\Scripts\Saxon\[Job.JobState].xsl" "%2\output.xml"
Batch %1 catches "%1"
Batch %2 catches "D:\Scripts\Saxon\[Job.JobState].xsl"
Batch %3 catches "%2\output.xml"
Hmm, too much information how my setup works! Let's go find a Mac solution, I'm not that experienced with Mac's but let's give it a try.
In your Command or Path you can try to specify your path to java with the Saxon jar:
path/to/java -jar path/to/saxon9he.jar
Your arguments need something like this:
-s:%1 -xsl:path/to/stylesheet.xsl -o:%2\output.xml
Notice the %2 at the end, it's not %3 like in my batch file!
Actually output.xml is not necessary since the XLS stylesheet does the file naming, however I couldn't get Saxon to work without specifying the output file.
I hope you can get it to work this way, else we need a way to 'translate' my Saxon.cmd to a Mac version, I hope some other forum member can join in to help us with that!
Re: xml data & HP digital front end JDF Control
Cool, good to know you figured it out, and thanks for sharing!
Now I notice your username I finally know were Rien was Lyncing about last week
Now I notice your username I finally know were Rien was Lyncing about last week