Jump to content

How to export a calculated field to xml ?


This topic is 4672 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

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.

Posted

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

  • Newbies
Posted

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.

Posted

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

  • Newbies
Posted

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.

This topic is 4672 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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