Submit point data to xml

Post Reply
LasseThid
Advanced member
Posts: 353
Joined: Tue Mar 03, 2015 2:30 pm
Location: Molndal, Sweden

Submit point data to xml

Post 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
Enfocus Switch, Enfocus PitStop Server, Enfocus PDF Review, HP SmartStream& Kodak Prinergy with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Submit point data to xml

Post 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
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.
LasseThid
Advanced member
Posts: 353
Joined: Tue Mar 03, 2015 2:30 pm
Location: Molndal, Sweden

Re: Submit point data to xml

Post by LasseThid »

Thanks Gabriel.

Turns out I don't need an xml file after all... :lol:

Good to know how to do it anyhow!
Enfocus Switch, Enfocus PitStop Server, Enfocus PDF Review, HP SmartStream& Kodak Prinergy with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.
loicaigon
Advanced member
Posts: 373
Joined: Wed Jul 10, 2013 10:22 am

Re: Submit point data to xml

Post 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
LasseThid
Advanced member
Posts: 353
Joined: Tue Mar 03, 2015 2:30 pm
Location: Molndal, Sweden

Re: Submit point data to xml

Post 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*
Enfocus Switch, Enfocus PitStop Server, Enfocus PDF Review, HP SmartStream& Kodak Prinergy with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.
Post Reply