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.

How to export a calculated field to xml ?

Featured Replies

  • Newbies

Hi,

I have a calculated field that contains the xml code I need to export. The problem is that when I export it the "<" and ">" tags are transformed into "&lt;" and "&gt;"

How can I get the xml code from my field into the final xml file ?

I must also say that I use an XSL template to modify my code to the desired format.

Here is the code in my calculated field as I see it in my FileMaker:


<dealer_id>4527</dealer_id>

<ownersvehicle_id>O17068</ownersvehicle_id>

<type>car</type>

<category>used</category>

<body>5_doors</body>

<brand>Renault</brand>

<model>Espace IV</model>

<version>PRIVILEGE</version>

<body_colorgroup>Gris Eclipse</body_colorgroup>

<doors>5 accents èàé</doors>

<gear_type>automatic</gear_type>

<gears></gears>

<fuel_type>Diesel</fuel_type>

<mileage>142000</mileage>

<initial_registration>2007-02-06</initial_registration>

<licence_number>XUW499</licence_number>

<notes>UNIQUEMENT SUR RENDEZ-VOUS

ENKEL OP AFSPRAAK

</notes> 





and here is my xsl template :





<?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" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">

<stx3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <vehicle_data>

	    <vehicles>



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

  <vehicle>

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

  </vehicle>

</xsl:for-each>



	    </vehicles>

    </vehicle_data>

</stx3>

</xsl:template>

</xsl:stylesheet>

Thank you for your help,

Adrian.

You're mixing two ways of creating an XML file here.

You can either setup the entire vehicle record like above, the export them all as .txt or .tab and add the top and tail manually, or set up an XML export with all of the fields individually and then run a more complicated stylesheet to transform to the final fie.

An XML export will encode any special characters on the way through, including your < and > - which is what is causing the issue, as it sees all of the calculation as needing this encoding

  • Author
  • Newbies

Hi Webko,

Thank you for your answer.

I have made a script that exports the data in tab format and then it ads the head and footer at the end and it's working fine.

Adrian.

Webko is right, just create the entire calculated XML (no XSLT needed). There are also a few things to know about XML/XSLT that might help:

disable-output-escaping <http://www.dpawson.co.uk/xsl/sect2/N2215.html>

&

xs:copy-of <http://dev.ektron.com/blogs.aspx?id=10472>

I don't know this these would work for you. It sounds like what you have is not very complex. Calculated xml and then export works well, too. I use it often. :)

Beverly

  • Author
  • Newbies

Hi Beverly,

Thank you for your answer.

My XML is not very complex and the calculated field does the job very well, so for the moment I am happy with it.

Kind regards,

Adrian.

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.