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.

xslt import window in filemaker doesn't show fields defined in xslt for importing

Featured Replies

I have an xslt that I modified awhile ago.  It imports eye exam data from refraction equipment into our software.  It worked fine for a long time.  The XML data format was changed in a few elements so I modified the xslt to match the format change.  Now when I try and import the data into filemaker the fields are not listed in the import window and, as a result, doesn't get imported.  Can someone look at the code and see if there is any obvious reason the fields aren't in the import window in Filemaker?

 

Note: I am not a xml/xslt expert and the original code was written by someone else.  I've just modified it over the years.

 

The following elements were originally as follows:

 

<?xml version="1.0"?>

<MarcoData-XML>

...

   <DataSet>

      <UnaidedVisualAcuity_Data>

         <DIST_OD>  20/20 </DIST_OD>

         <DIST_OS>  20/20 </DIST_OS>

         <DIST_OU>  10/20 </DIST_OU>

         ...

      </UnaidedVisualAcuity_Data>

...

   </DataSet>

</MarcoData-XML>

 

The format of their data was changed to:

 

<?xml version="1.0"?>

<MarcoData-XML>

...

   <DataSet>

      <UnaidedVisualAcuity_Data>

         <DIST_OD>  20 </DIST_OD>

         <DIST_OS>  20 </DIST_OS>

         <DIST_OU>  10 </DIST_OU>

         ...

      </UnaidedVisualAcuity_Data>

...

   </DataSet>

</MarcoData-XML>

 

Here is the relevant xslt

 

<?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="UTF-8" indent="yes" />
<xsl:template match="/">
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="" NAME="Filemaker Pro" VERSION="" />
<DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT="h:mm:ss a" />
<METADATA>

 

    <xsl:if test="string-length(/MarcoData-XML/DataSet/UnaidedVisualAcuity_Data/DIST_OD) != 0">
       <FIELD NAME="Entrance VA OD"    TYPE="TEXT" />
    </xsl:if>
    <xsl:if test="string-length(/MarcoData-XML/DataSet/UnaidedVisualAcuity_Data/DIST_OS) != 0">
       <FIELD NAME="Entrance VA OS"    TYPE="TEXT" />
    </xsl:if>
    <xsl:if test="string-length(/MarcoData-XML/DataSet/UnaidedVisualAcuity_Data/DIST_OU) != 0">
       <FIELD NAME="OU Va uncorrected" TYPE="TEXT" />
    </xsl:if>

 

</METADATA>

<RESULTSET FOUND="">
<xsl:for-each select="/MarcoData-XML/DataSet">
<ROW MODID="" RECORDID="">

<!-- Entrance VA OD -->
<xsl:if test="string-length(./UnaidedVisualAcuity_Data/DIST_OD) != 0" >
   <COL>
   <DATA>
      <xsl:value-of select="./UnaidedVisualAcuity_Data/DIST_OD" />
   </DATA>
   </COL>
</xsl:if>
<!-- Entrance VA OS -->
<xsl:if test="string-length(./UnaidedVisualAcuity_Data/DIST_OS) != 0">
   <COL>
   <DATA>  
      <xsl:value-of select="./UnaidedVisualAcuity_Data/DIST_OS" />
   </DATA>
   </COL>
</xsl:if>
<!-- OU Va uncorrected -->
<xsl:if test="string-length(./UnaidedVisualAcuity_Data/DIST_OU) != 0">
   <COL>
   <DATA>
      <xsl:value-of select="./UnaidedVisualAcuity_Data/DIST_OU" />
   </DATA>
   </COL>
</xsl:if>

 

</ROW>
</xsl:for-each>
</RESULTSET>
</FMPXMLRESULT>
</xsl:template>

</xsl:stylesheet>

 

See attached XML and xslt below for more information.  NOTE:  I changed the .xsl to .txt so it would upload.

RT5100Output.xml

RT5100-xsl 4 import-without habitual.txt

I don't understand your question:

 

You say that "the XML data format was changed" - but the only change you show us is in the data, not in the format.

 

You say that "the fields are not listed in the import window" - but when I try to import the XML file you have attached, using the stylesheet you have attached, I see this:

 

post-72594-0-91670700-1427830628_thumb.p

 

  • Author

Sorry,  it is the data, not the format.

And, I don't see the first three fields listed at the top of the window.

That is my problem.

 

When I do an import I specify matching names and update existing records in found set.

And, I don't see the first three fields listed at the top of the window.

That is my problem.

 

It's a problem I cannot reproduce using the two files you have attached. So either you are not using the same two files, or your Filemaker is behaving differently than mine.

  • Author

It's a problem I cannot reproduce using the two files you have attached. So either you are not using the same two files, or your Filemaker is behaving differently than mine.

 

The files I attached are my production code.

So, it seems my Filemaker is behaving differently than yours.

 

That said, do you know what sorts of things in the database could cause this to happen or have any idea how to go about debugging the problem?

I would hate to tell the doctors to enter the data manually if it doesn't import correctly.

That defeats the purpose of the interface.

 

Thanks for all your help.

So, it seems my Filemaker is behaving differently than yours.

 

That's not very likely. Fortunately, it can be easily tested - just run the script in the attached file.

 

Compressed file.zip

  • Author

Yes, you are correct the data imports correctly on the test case.

Thanks for verifying that for me.

So, my xml and xslt are correct.

 

But, the reality is, it doesn't import correctly in our live databases (as in multiple customers)

I'm trying to figure out what could be causing the problem.

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.