I manage a Filemaker system for our company and we need to export an xml product order to one of our vendors for their EDI system. I am a complete hack at this xslt but somehow I have managed to create the following xslt template based on their requirements that ALMOST works. My problem is that I need to put data from our Filemaker system "PO_Num" into the ID= area of the purchase order in place of "TestPO" and have no idea how to format it
<purchaseOrder orderDate="2015-08-15" id= "TestPO" >
Here is our full xslt code:
<?xml version='1.0' encoding='UTF-8' ?>
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:fm="http://www.filemaker.com/fmpdsoresult"
exclude-result-prefixes="fm">
<xsl:output version='1.0' encoding='UTF-8' indent='yes' method='xml' />
<xsl:template match="/">
<Order>
<xsl:for-each select="fm:FMPDSORESULT/fm:ROW">
<purchaseOrder orderDate="2015-08-15" id= "TestPO" >
<referenceNumber></referenceNumber>
<customer_ID><xsl:value-of select="fm:Account_Number_Prog_Code"/></customer_ID>
<subteamName></subteamName>
<shipdate>2015-09-15</shipdate>
<shipdateqaulifier></shipdateqaulifier>
<vendor country="US">
<name>Vendor Name</name>
<address>1234 Main Street</address>
<address2></address2>
<city>Anytown</city>
<state>NY</state>
<zip>00000</zip>
<phone>123-456-7890</phone>
</vendor>
<billto country="US">
<name>Our Company</name>
<address>4321 South Street</address>
<address2>#275</address2>
<city>Your Town</city>
<state>CA</state>
<zip>00000</zip>
<phone>800-432-1234</phone>
<fax>800-432-1235</fax>
</billto>
<shipto country="US">
<name><xsl:value-of select="fm:Store_Name"/></name>
<address><xsl:value-of select="fm:Store_Address"/></address>
<address2></address2>
<city><xsl:value-of select="fm:Store_City"/></city>
<state><xsl:value-of select="fm:Store_State"/></state>
<zip><xsl:value-of select="fm:Store_Zip"/></zip>
<phone><xsl:value-of select="fm:Store_Phone"/></phone>
<fax><xsl:value-of select="fm:Store_Fax"/></fax>
</shipto>
<buyer country="US">
<name>Our Company</name>
<address>4321 South Street</address>
<address2>#275</address2>
<city>Your Town</city>
<state>CA</state>
<zip>00000</zip>
<phone>800-432-1234</phone>
</buyer>
<comment></comment>
<customer><xsl:value-of select="fm:Account_Number_Prog_Code"/></customer>
<acknowledge_note ></acknowledge_note>
<items>
<item vendorPartNum="012345678912">
<WFMSKU>12345</WFMSKU>
<posDept></posDept>
<productName>PRODUCt BUNDLE</productName>
<casePack>1</casePack>
<packSize></packSize>
<UOM></UOM>
<USPrice>Bundle Price</USPrice>
<quantity Unit="EA">1</quantity>
<eaches>1</eaches>
</item>
</items>
</purchaseOrder>
</xsl:for-each>
</Order>
</xsl:template>
</xsl:stylesheet>
It produces this result below that is almost perfect for us except that I don't know how to replace the "TestPO" text in the template with actual data link from the Filemaker PO_Num field. Using the xsl:value-of select="fm:PO_Num" does not work in that id= portion of the code:
<?xml version="1.0" encoding="UTF-8"?>
<Order>
<purchaseOrder orderDate="2015-08-15" id="TestPO">
<referenceNumber/>
<customer_ID>GN1234567</customer_ID>
<subteamName/>
<shipdate>2015-09-15</shipdate>
<shipdateqaulifier/>
<vendor country="US">
<name>Vendor Name</name>
<address>1234 Main Street</address>
<address2/>
<city>Anytown</city>
<state>NY</state>
<zip>00000</zip>
<phone>123-456-7890</phone>
</vendor>
<billto country="US">
<name>Our Company</name>
<address>4321 South Street</address>
<address2>#275</address2>
<city>Your Town</city>
<state>CA</state>
<zip>00000</zip>
<phone>800-432-1234</phone>
<fax>800-432-1235</fax>
</billto>
<shipto country="US">
<name>Test Store</name>
<address>1234 West Street</address>
<address2/>
<city>My Town</city>
<state>CA</state>
<zip>91105</zip>
<phone>213-123-1235</phone>
<fax>213-123-1234</fax>
</shipto>
<buyer country="US">
<name>Our Company</name>
<address>4321 South Street</address>
<address2>#275</address2>
<city>Your Town</city>
<state>CA</state>
<zip>00000</zip>
<phone>800-432-1234</phone>
</buyer>
<comment/>
<customer>GN1234567</customer>
<acknowledge_note/>
<items>
<item vendorPartNum="012345678912">
<WFMSKU>12345</WFMSKU>
<posDept/>
<productName>PRODUCt BUNDLE</productName>
<casePack>1</casePack>
<packSize/>
<UOM/>
<USPrice>Bundle Price</USPrice>
<quantity Unit="EA">1</quantity>
<eaches>1</eaches>
</item>
</items>
</purchaseOrder>
</Order>
I am sure this is a probably a simple fix but I seem to be in way over my head. Any solutions or suggestions would be greatly appreciated!
Thanks, Bob
how to replace the "TestPO" text in the template with actual data link from the Filemaker PO_Num field.
It's difficult to answer your question without seeing your raw export. Try:
<purchaseOrder orderDate="2015-08-15" id="{fm:PO_Num}">
Of course, the date shouldn't be hard-coded either.