Jump to content
Server Maintenance This Week. ×

Export to XML. Need help creating XSL Style Sheet


Nestor

This topic is 3226 days old. Please don't post here. Open a new topic instead.

Recommended Posts

 SalesOrder_MagentoSales.xsd SalesOrder_MagentoSales.xsdHi and thanks in advance if you are reading my issue.  I have data in filemaker that i need to export to XML so my ERP system can pull it in and create a Sales order.

I have the XML Schema and also have a sample XML of what it should look like.  The missing piece is i don't have a XSL style sheet and not sure where to start or how to create one.

I been looking a many sites and many post, but feel I'm getting more confused than anything else.  Can somebody point me in the right direction or possibly help me create the XSL Style sheet?  I'm a visual person and have tried looking for videos or instructions, but not luck yet.  The ERP system we're using is Microsoft AX 2012 R2 and will be using an AIF port to pull the XML to create the order.  Any help would be appreciate it..

Attached is the XML Schema and the XML sample and the FM database with the data.

Thank you

 

SalesOrder_MagentoSales.xsd

B2B_MagentoOrder.xml

ExternalOrders.zip

Edited by Nestor
Link to comment
Share on other sites

Try this as your starting point:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ord="http://schemas.microsoft.com/dynamics/2008/01/documents/SalesOrder"
exclude-result-prefixes="ord">
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>

<xsl:template match="/">
	<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
		<METADATA>
			<FIELD NAME="ItemId" TYPE="TEXT"/>
			<FIELD NAME="Price" TYPE="NUMBER"/>
			<FIELD NAME="Qty" TYPE="NUMBER"/>
		</METADATA>
		<RESULTSET>
			<xsl:for-each select="//ord:SalesLine">
				<ROW>
					<COL><DATA><xsl:value-of select="ord:ItemId"/></DATA></COL>
					<COL><DATA><xsl:value-of select="ord:SalesPrice"/></DATA></COL>
					<COL><DATA><xsl:value-of select="ord:SalesQty"/></DATA></COL>
				</ROW>
			</xsl:for-each>
		</RESULTSET>
	</FMPXMLRESULT>
</xsl:template>
</xsl:stylesheet>

 

Link to comment
Share on other sites

Oh no. I am afraid I totally misread your post: I thought you wanted to import the data into Filemaker. Of course it's not going to work for exporting, sorry about that.

Will you ever export more than one order in the same XML document?

 

 

Link to comment
Share on other sites

In such case, I would suggest you export from the Orders table, and include fields from the line items table in the field export order.

Have a look at the attached example.

Note that a field's position if the field export order is used to identify it for the purposes of getting data from it.  If you change it, you must also adjust the field's ordinal number (in square brackets) when referring to it in the stylesheet.

 

 

Compressed file.zip

Link to comment
Share on other sites

This topic is 3226 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.