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.

Featured Replies

  • Newbies

Hello there,

 

I'm working on using XSL to change a Filemaker export using FMPXMLRESULT grammar to a different XML structure. Only a single field is needed from the Filemaker export file, however the closest i've gotten to successfully change the format is by setting <xsl:template match="/"> yet displays the error code of 0. I've tried to specify my match field to<xsl:template match="fmp:FMPXMLRESULT/fmp:RESULTSET" > however that causes my format to disappear and still display the error code. Any assistance to point me in the right direction or point out my mistakes would be greatly appreciated.

 

FMP XML:

<?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="ProAdvanced 13.0v5"/>

<DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="" RECORDS="2" TIMEFORMAT="h:mm:ss a"/><METADATA>

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

</METADATA>

<RESULTSET FOUND="1">

<ROW MODID="6" RECORDID="2">

<COL>

<DATA>asdasdasd</DATA>

</COL>

</ROW>

</RESULTSET>

</FMPXMLRESULT>

 

XSL:

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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/FMPXMLRESULT" exclude-result-prefixes="fmp">

<xsl:output method="xml" indent="yes" encoding="UTF-8" version="1.0"/>

 

<xsl:template match="/">

     <RESPONSE>

   <SAY>

     <xsl:call-template name="info"/>

    </SAY>

     </RESPONSE>

    </xsl:template>

  

    <xsl:template match="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW" name="info">

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

    </xsl:template>

  

  </xsl:stylesheet>

 

OUTPUT:

 

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

 

DESIRED OUTPUT:

<RESPONSE>

<SAY>

Field value (Which is asdasdasd right now)

</SAY>

</RESPONSE>

There are several reasons why your stylesheet doesn't work, the first being that XML is case-sensitive and your declaration:

xmlns:fmp="http://www.filemaker.com/FMPXMLRESULT"

does not match the Filemaker namespace declared in the XML source:

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

The second reason is that when you call a template by name, its match attribute is ignored and the current context (which is the "/" root node in your case) is not changed. From that context, the path you use in:

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

does not select anything, because COL is not a child of the root node.

 

 

If your export has only one record and one field, you could make this much simpler:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fmp="http://www.filemaker.com/fmpxmlresult"
exclude-result-prefixes="fmp">
<xsl:output method="xml" indent="yes" encoding="UTF-8" version="1.0"/>

<xsl:template match="/">
   <RESPONSE>
      <SAY>
         <xsl:value-of select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW/fmp:COL/fmp:DATA"/>
      </SAY>
  </RESPONSE>
</xsl:template>

</xsl:stylesheet>
  • Author
  • Newbies

Thank you for the concise explanation! The different in xlms:fmp case caused me hours of trouble, I won't be making that mistake again. 

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.