Page 1 of 1
Submit point data to xml
Posted: Mon Nov 06, 2017 4:54 pm
by LasseThid
I'd like to export metadata entered at a Submit point as an xml file for use in Phoenix (imposition tool).
Currently I see the data as External > Submit in the Build location path window.
I have tired the Export metadata configurator, but I can't seem to get the metadata as an xml.
Any ideas on how to do this?
Thanks
Re: Submit point data to xml
Posted: Mon Nov 06, 2017 6:54 pm
by gabrielp
On your submit point, there will be a value for setting the dataset name. Use that same name when you export the metadata and it should work fine.
This is handy for debugging job tickets:
https://github.com/open-automation/swit ... ket-export
Re: Submit point data to xml
Posted: Tue Nov 07, 2017 10:20 am
by LasseThid
Thanks Gabriel.
Turns out I don't need an xml file after all...
Good to know how to do it anyhow!
Re: Submit point data to xml
Posted: Tue Nov 07, 2017 11:48 am
by loicaigon
XSLT can output simple text strings and switch can automatically save it as csv (in the sense it adds the extension).
Here is some code to turn your xml into CSV:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:text>ordernummer;material;gramvikt;antal
</xsl:text>
<xsl:value-of select="//*[tag='Ordernummer']/value"/>
<xsl:text>;</xsl:text>
<xsl:value-of select="//*[tag='Material']/value"/>
<xsl:text>;</xsl:text>
<xsl:value-of select="//*[tag='Gramvikt']/value"/>
<xsl:text>;</xsl:text>
<xsl:value-of select="//*[tag='Antal']/value"/>
</xsl:template>
</xsl:stylesheet>
HTH
Re: Submit point data to xml
Posted: Tue Nov 07, 2017 1:54 pm
by LasseThid
Thanks Loic.
I really appreciate you helping me out with the XSLT.
Even though it turns out I don't need it, I will save it for later in case I need it in the future.
As I edited this post after Loic saw it I will post the xml code from the Submit point again as well as the result I was looking for so anyone else who has a problem with these thing can look at Loic's solution and hopefully learn something as well.
Original xml from my submit point:
Code: Select all
<field-list>
<field Id="spMF_7_6">
<tag>Ordernummer</tag>
<type>string</type>
<required>false</required>
<value>P123456</value>
</field>
<field Id="spMF_1_6">
<tag>Material</tag>
<type>choice</type>
<items>
<item>2-stand Ellipse</item>
<item>Alu-plastskiva</item>
<item>Bestruket Silk</item>
<item>Brun Board</item>
<item>Display Kartong</item>
<item>Kanalplast</item>
<item>Kapaplast</item>
<item>Kartong</item>
<item>Maine Opak</item>
<item>Plastskiva lättvikt</item>
<item>PP-ark</item>
<item>Reboard</item>
<item>Skummad plastskiva</item>
<item>Smart X</item>
<item>Wellark E-flute</item>
</items>
<value>Kanalplast</value>
<field-list>
<field Id="spMF_3_6">
<tag>Gramvikt</tag>
<type>choice</type>
<items>
<item>500 gr</item>
<item>1780 gr</item>
<item>3200 gr</item>
</items>
<value>3200 gr</value>
</field>
</field-list>
</field>
<field Id="spMF_6_6">
<tag>Antal</tag>
<type>string</type>
<required>false</required>
<value>15</value>
</field>
</field-list>
What I was looking for was an XSLT that would give me a filtered xml like this.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<order>
<ordernummer>P123456</ordernummer>
<material>Kanalplast</material>
<gramvikt>3200</gramvikt>
<antal>15</antal>
</order>
Loic's XSLT will output this as a CSV file, because I thought I needed a CSV file for use with Phoenix for automation until I looked at the configurator and realized that I can actually use the metadata from the submit point to do what I want to do... *facepalm*