Jump to content

export XML with xsl using field names


alexinmux

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

Recommended Posts

  • Newbies

Hello,

 

after solving my XML import I'm tring to export the whole stuff :-)

 

So is it possible to use "field names" in the xsl instead of 

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

Looking in the exported XML without using an xsl there is a Metadata block with the field names.

 

So this would be much more readable and errorproof than counting the Data

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

Regards Michael

Link to comment
Share on other sites

Perhaps you'd be more comfortable selecting the FMPDSORESULT grammar when exporting.

The general idea here is that the FMPXMLRESULT grammar allows you to rename your fields freely without breaking the stylesheet - as long as the field export order remains unchanged. Conversely, in the FMPDSORESULT grammar the field order is unimportant, but the field names are crucial. You pays your money and you takes your choice.

Link to comment
Share on other sites

  • Newbies

Thanks for the fast reply. In the mean time I've found here (last post) something interesting by building variables from the field names. But on the first try it doesn't work... http://stackoverflow.com/questions/13137517/filemaker-xml-export-via-xslt

 

Looking in a file exported with FMPDSORESULT looks also promising. But there is warning in the 2nd line with would translate from german to something like "this grammar is depracted, use FMPXMLRESULT instead." So how long will FMPDSORESULT exists?

 

 

By the way in both exported files I get something like this:

<metaAutoren>Sälzer
Sabine
Dickhaut
Sebastian</metaAutoren>

but need it this way:

<Autoren>
   <Liste>
      <Wert>Sälzer</Wert>
      <Wert>Sabine</Wert>
      <Wert>Dickhaut</Wert>
      <Wert>Sebastian</Wert>
  </Liste>
</Autoren>

do you have an idea for that problem?

Link to comment
Share on other sites

I've found here (last post) something interesting by building variables from the field names.

 

Yes, there are several ways to use field names with FMPXMLRESULT, none of them too simple - and really, at the end it's just combining the worst of both worlds. If you prefer to call data out by field names, use the FMPDSORESULT grammar.

 

 

"this grammar is depracted, use FMPXMLRESULT instead." So how long will FMPDSORESULT exists?

 

No one can answer that. FMI is free to pull any feature from future versions without giving any advance warning (and it has happened, too). That said, FMPDSORESULT has been deprecated since version 7, IIRC, so...

 

 

I get something like this:

<metaAutoren>Sälzer
Sabine
Dickhaut
Sebastian</metaAutoren>

 

Such are the wages of sin. Because the true solution here is to import the data into a related table as individual records to begin with. Then you could get something like:

<COL>
    <DATA>Sälzer</DATA>
    <DATA>Sabine</DATA>
    <DATA>Dickhaut</DATA>
    <DATA>Sebastian</DATA>
</COL>

when exporting, which is very easy to work with using xsl:for-each. The way you have it now, you will need to tokenize the text string into elements, using a recursive template.

Link to comment
Share on other sites

  • Newbies

Thank you for the enlightening about the deprecated grammar. So I will hope the will leave it as it is for some further version :-)

<metaAutoren>Sälzer
Sabine
Dickhaut
Sebastian</metaAutoren>

This are values from a field with checkboxes so I have to go the road with the tokenizing. I will come back asking about it if I can't figure it out myself.

 

The road with xsl:for-each I already know from importing data and I go for it again when I have to deal with data from some portal rows. And I'm seeing some fun there. Perhaps grouping at export time will give simplify easier dat to parse. So it's playtime again :-)

Link to comment
Share on other sites

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