Filemaker xsl help please

Hi ,

When i do an export from filemaker , i am getting the below xml data.

<?xml version="1.0" encoding="UTF-8" ?><FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"><ERRORCODE>0</ERRORCODE><PRODUCT BUILD="01-09-2015" NAME="FileMaker" VERSION="Pro 13.0v5"/><DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="GunsAmmoCatalog-02.fmp12" RECORDS="9" TIMEFORMAT="h:mm:ss a"/><METADATA>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="_NetworkID" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="_SharedSecret" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="_deploymentMode" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="orderid" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="orderdate" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="_orderType" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="shipaddress1" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="shipaddress2" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="shipcity" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="shipfirstname" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="shiplastname" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderDetails_MTR::quantity" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderDetails_MTR::productcode" TYPE="TEXT"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="OrderDetails_MTR::vendor_price" TYPE="TEXT"/>
</METADATA>
<RESULTSET FOUND="1"><ROW MODID="2" RECORDID="8">
<COL><DATA>85768</DATA></COL>
<COL><DATA>xxxx</DATA></COL>
<COL><DATA>test</DATA></COL>
<COL><DATA>8</DATA></COL>
<COL><DATA>3/24/2015 5:30:00 PM</DATA></COL>
<COL><DATA>NEW</DATA></COL>
<COL><DATA>953 Trents Mill Road</DATA></COL>
<COL><DATA></DATA></COL>
<COL><DATA>Cumberland</DATA></COL>
<COL><DATA>Barry</DATA></COL>
<COL><DATA>Rickert</DATA></COL>
<COL><DATA>1</DATA></COL>
<COL><DATA>10124S</DATA></COL>
<COL><DATA>447</DATA></COL>
</ROW>
</RESULTSET>
</FMPXMLRESULT>

Open in new window


I want them to create an html as below using an XSl file, please help on creating an XSL file which produce the below html format.Some fields are constants , i will add them later.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<style type="text/css">body,table,td {font: 11px Verdana; color: #000000;}</style>
<body text="#000000">
<table width="650" border="1" cellspacing="0" cellpadding="20" bgcolor="#FFFFFF" bordercolor="#CCCCCC" align="center">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="1" cellpadding="5">
        <tr valign="top"> 
          <td><a href="../../Default.asp">$(CompanyLogo)</a></td>
		  <td align="right">CustomerID# $(CustomerID)</td>
		</tr>
	  </table>
	  <br>
      <br>
      Thank you for your order. Your order number is $(OrderNo), placed $(OrderDate)
      at $(OrderTime). <br>
      <br>
      <table width="100%" border="0" cellspacing="1" cellpadding="5">
        <tr valign="top"> 
          <td><b>Bill To:</b><br> <br>
            $(Bill_CompanyName) $(Bill_FirstName)&nbsp;$(Bill_LastName)<br>
            $(Bill_Address1)<br>
            $(Bill_Address2) $(Bill_City), $(Bill_State)&nbsp;$(Bill_PostalCode) 
            <br>
            $(Bill_Country) <br>
            $(Bill_PhoneNumber)<br>
			$(EmailAddress)<br>
			<br></td>
          <td><b>Ship To:</b><br> <br>
            $(Ship_CompanyName) $(Ship_FirstName)&nbsp;$(Ship_LastName)<br>
            $(Ship_Address1)<br>
            $(Ship_Address2) $(Ship_City), $(Ship_State)&nbsp;$(Ship_PostalCode) 
            <br>
            $(Ship_Country) <br>
            $(Ship_PhoneNumber) <br> </td>
        </tr>
        <tr valign="top"> 
          <td><b>Payment Info:</b> <br> <br>
            $(DisplayPaymentMethod)<br> <br> </td>
          <td><b>Shipping Method:</b><br> <br>
            $(ShippingMethod)<br> </td>
        </tr>
        <tr valign="top"> 
          <td colspan="2"><b>Order Details:</b><br> <br>
            $(OrderDetails) <br> </td>
        </tr>
      </table>

$(Order_Comments)
$(Custom_Fields)
      <br>
      Thank you for shopping at $(StoreName)!<br>
      Visit us again at <a href="$(HomeURL)">$(HomeURL)</a></td>
  </tr>
</table>
</body>
</html>

Open in new window


Thanks
LVL 5
magentoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will LovingPresident, Dedication Technologies, Inc.Commented:
I don't have experience with creating XSL translation files but you might find help here:

http://bluefeathergroup.com/blog/importing-xml-data-into-filemaker-using-xslt-xsl-style-sheets/

http://www.experts-exchange.com/Software/Apple_Software/Filemaker_Pro/Q_25329773.html

Something you could do as an alternative is create a calculation field in FileMaker that concatenates all the HTML and field values. I've put quotes around all the text strings and added a mockup table name for each field that you want to include, e.g. Orders::OrderDate. The quotes (and any backslashes that might be added) need to be escaped with a backslash character. Something like:

HTML_Output_Calc =

"<html>
<head>
<meta http-equiv=\”Content-Type\” content=\”text/html; charset=iso-8859-1\”>
</head>
<style type=\”text/css\”>body,table,td {font: 11px Verdana; color: #000000;}</style>
<body text=\”#000000\”>
<table width=\”650\” border=\”1\” cellspacing=\”0\” cellpadding=\”20\” bgcolor=\”#FFFFFF\” bordercolor=\”#CCCCCC\” align=\”center\”>
  <tr>
    <td>
      <table width=\”100%\” border=\”0\” cellspacing=\”1\” cellpadding=\”5\”>
        <tr valign=\”top\”> 
          <td><a href=\”../../Default.asp\”>$(“   & TableName::CompanyLogo & “)</a></td>
		  <td align=\”right\”>CustomerID# $(“ & Customer::CustomerID & “)</td>
		</tr>
	  </table>
	  <br>
      <br>
      Thank you for your order. Your order number is $(“ & Orders::OrderNo & “), placed $(“ & Orders::OrderDate & “)
      at $(“ & Orders::OrderTime & “). <br>
      <br>
      <table width=\”100%\” border=\”0\” cellspacing=\”1\” cellpadding=\”5\”>
        <tr valign=\”top\”> 
          <td><b>Bill To:</b><br> <br>
            $(“ & Customer::Bill_CompanyName & “) $(“ & Customer::Bill_FirstName & “ )&nbsp;$( “ & Customer::Bill_LastName & “)<br>
            $(“ & Customer::Bill_Address1 & “)<br>
            $(“ & Customer::Bill_Address2 & “) $(“ & Customer::Bill_City), $(“ & Customer::Bill_State & “)&nbsp;$( “ & Customer::Bill_PostalCode & …..

Open in new window

zc2Commented:
magento,
the html sample has many fields that do not have a match in the XML
Nevertheless, I made an XSLT processing existing fields.
My XSLT apparently is not very elegant, because it enumerates the FIELD nodes one more extra time in the template to find the position.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:f="http://www.filemaker.com/fmpxmlresult">
<xsl:output method="html" encoding="iso-8859-1"/>

<xsl:template match="/">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
</head>
<style type="text/css">body,table,td {font: 11px Verdana; color: #000000;}</style>
<body text="#000000">
<table width="650" border="1" cellspacing="0" cellpadding="20" bgcolor="#FFFFFF" bordercolor="#CCCCCC" align="center">
  <tr>
    <td>
      <xsl:apply-templates select="/f:FMPXMLRESULT/f:METADATA"/>
    </td>
  </tr>
</table>
</body>
</html>
                                  
</xsl:template>

<xsl:template match="f:METADATA">
      <table width="100%" border="0" cellspacing="1" cellpadding="5">
        <tr valign="top"> 
          <td><a href="../../Default.asp">$(CompanyLogo)</a></td>
		  <td align="right">CustomerID# $(CustomerID)</td>
		</tr>
	  </table>
	  <br/>
      <br/>
      Thank you for your order. Your order number is <xsl:apply-templates 
      	select="f:FIELD[@NAME='orderid']"/>, placed <xsl:apply-templates 
      	select="f:FIELD[@NAME='orderdate']"/>
      at $(OrderTime). <br/>
      <br/>
      <table width="100%" border="0" cellspacing="1" cellpadding="5">
        <tr valign="top"> 
          <td><b>Bill To:</b><br/> <br/>
            $(Bill_CompanyName) $(Bill_FirstName)&#xA0;$(Bill_LastName)<br/>
            $(Bill_Address1)<br/>
            $(Bill_Address2) $(Bill_City), $(Bill_State)&#xA0;$(Bill_PostalCode) 
            <br/>
            $(Bill_Country) <br/>
            $(Bill_PhoneNumber)<br/>
			$(EmailAddress)<br/>
			<br/></td>
          <td><b>Ship To:</b><br/> <br/>
            $(Ship_CompanyName) <xsl:apply-templates 
      	select="f:FIELD[@NAME='shipfirstname']"/>&#xA0;<xsl:apply-templates 
      	select="f:FIELD[@NAME='shiplastname']"/><br/>
            <xsl:apply-templates 
      	select="f:FIELD[@NAME='shipaddress1']"/><br/>
            <xsl:apply-templates 
      	select="f:FIELD[@NAME='shipaddress2']"/> <xsl:apply-templates 
      	select="f:FIELD[@NAME='shipcity']"/>, $(Ship_State)&#xA0;$(Ship_PostalCode) 
            <br/>
            $(Ship_Country) <br/>
            $(Ship_PhoneNumber) <br/> </td>
        </tr>
        <tr valign="top"> 
          <td><b>Payment Info:</b> <br/> <br/>
            $(DisplayPaymentMethod)<br/> <br/> </td>
          <td><b>Shipping Method:</b><br/> <br/>
            $(ShippingMethod)<br/> </td>
        </tr>
        <tr valign="top"> 
          <td colspan="2"><b>Order Details:</b><br/> <br/>
            $(OrderDetails) <br/> </td>
        </tr>
      </table>

$(Order_Comments)
$(Custom_Fields)
      <br/>
      Thank you for shopping at $(StoreName)!<br/>
      Visit us again at <a href="$(HomeURL)">$(HomeURL)</a>
</xsl:template>
	
<xsl:template match="f:FIELD">
	<xsl:variable name="fid" select="generate-id()"/>
	<xsl:for-each select="../f:FIELD">
		<xsl:if test="generate-id() = $fid">
			<xsl:variable name="p" select="position()"/>
			<xsl:value-of select="../../f:RESULTSET/f:ROW/f:COL[$p]/f:DATA"/>
		</xsl:if>	
	</xsl:for-each>
	
	</xsl:template>
	
</xsl:stylesheet>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
magentoAuthor Commented:
Sorry for the delayed response , i will revert quickly.

Thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.