Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

LS,

I am trying to build a xml-file based on an xml-result export.

I want it to look like :

<data>

<record>

<ID>1</ID>

<name_last>Miltenburg</name_last>

<name_first>Joost</name_first>

...

</record>

</data>

I have the xml-result : (part)

<METADATA>

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

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

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

...

</METADATA>

What I want is to dynamically get all the different values of the NAME-attributes of the field elements. How do I do that ? That way I'd only have to write one xsl for all my exports.

So it would be a loop within the looping of the records.

Any help would be appreciated...

Posted

Try doing this for each fmp:COL:

<xsl:variable name="pos" select="position()"/>

<xsl:element name="{../../../fmp:METADATA/fmp:FIELD[$pos]/@NAME}">

<xsl:value-of select="fmp:DATA"/>

</xsl:element>

Note that this will fail if your field names are not valid element names (e.g. they contain spaces).

Exporting as FPMDSORESULT would probably be even simpler.

  • 7 months later...
Posted

Thnx !

I should have figured this out myself...

You are right about the FPMDSORESULT remark. However, this has been deprecated for quite a while now. This gives me some future proofing, for my xml exports.

Thnx again... :laugh:

This topic is 4577 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.