Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Help constructing XSL

Featured Replies

I have an xml response that I'd like to filter thru an XSL and import into filemaker.

It contains the info for a standard order - buyer contact and several items ordered.

Here is a sample response file -

<?xml version="1.0" encoding="ISO-8859-1"?>

<orderUpdateResponse version="1.0">

<purchaseOrder id="87047440DONOTIMPORT">

<buyer id="3392278">

<email>[email protected]</email>

<mailingAddress>

<city>Manassas</city>

<code>22204</code>

<country>USA</country>

<name>Some Dude</name>

<phone>703444 5555</phone>

<street>666 Old Dominion Way</street>

</mailingAddress>

</buyer>

<buyerPurchaseOrder id="DONOTIMPORT" />

<orderTotals>

<gst currency="USD">0.0</gst>

<handling currency="USD">0.0</handling>

<shipping currency="USD">30.0</shipping>

<subtotal currency="USD">95.0</subtotal>

<tax currency="USD">0.0</tax>

<total currency="USD">125.0</total>

</orderTotals>

<purchaseOrderItemList>

<purchaseOrderItem id="89776655DONOTIMPORT">

<book id="34565478754DONOTIMPORT>

<vendorKey>identificationinfo1</vendorKey>

</book>

<purchaseOrder id="87047440DONOTIMPORT" />

</purchaseOrderItem>

<purchaseOrderItem id="89337622DONOTIMPORT">

<book id="3255656543DONOTIMPORT">

<vendorKey>identificationinfo2</vendorKey>

</book>

<purchaseOrder id="87047440DONOTIMPORT" />

</purchaseOrderItem>

<purchaseOrderItem id="89337623DONOTIMPORT">

<book id="3797027063DONOTIMPORT">

<vendorKey>identificationinfo3</vendorKey>

</book>

<purchaseOrder id="87047440DONOTIMPORT" />

</purchaseOrderItem>

</purchaseOrderItemList>

</purchaseOrder>

</orderUpdateResponse>

In filemaker I have an order layout with a portal of the items ordered.

Below is my XSLT style sheet so far, I'm lost, especially on how to import the multiple items of an order -

I would be grateful for any corrections and help.

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" version="1.0" encoding="ISO-8859-1" indent="yes"/>

<xsl:template match="/">

<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">

<ERRORCODE>0</ERRORCODE>

<PRODUCT BUILD="" NAME="" VERSION=""/>

<DATABASE DATEFORMAT="" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT=""/>

<METADATA>

<FIELD NAME="email" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="shipCity" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="shipPostalCode" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="shipCountry" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="shipName" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="shipPhone" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="shipAddress1" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="handling_cart" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="orderSubtotal" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="SalesTax" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

<FIELD NAME="orderTotal" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>

</METADATA>

<xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">

<vendorBookID><xsl:value-of select="fmp:COL[1]/fmp:DATA" /></vendorBookID>

</xsl:for-each>

</xsl:template>

</xsl:stylesheet>

how to import the multiple items of an order

You should import the items into a OrderItems table. And the buyer info into a Buyers table. So that's three separate imports, each with its own stylesheet. Or you could import everything into a flat table (where each record is an order item and the other data is duplicated). Then you can do the other imports from there (or leave it as is - it really depends on what you intend to do with this).

<xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">

<vendorBookID><xsl:value-of select="fmp:COL[1]/fmp:DATA" /></vendorBookID>

</xsl:for-each>

This makes no sense: you are importing, not exporting. There is no FMPXMLRESULT to select from.

  • Author

consultant,

thanks for the quick response.

hadn't thought about splitting up the imports, good idea.

but here's the issue, i get many responses some with just one order item, some with twenty. there is no fixed amount. what is the code language to loop the multiple items? this is what i'm scratching at.

thanks.

i get many responses some with just one order item, some with twenty. there is no fixed amount. what is the code language to loop the multiple items?

Create a new record (i.e. a Filemaker ROW) for each purchaseOrderItem.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.