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

Attention: Before posting in the general discussion forum please review the other forums that would best suit your topic.
If you cannot find one then you may delete this text and post your topic in this forum.

Hi all, I need to import into filemaker table an XML file as this:

<?xml version="1.0" encoding="utf-8"?>
<Account>
  <Field APIName="WrntyID">6029065</Field>
  <Field APIName="ExternalID">1761A</Field>
  <Field APIName="Name">sayIT SA</Field>
</Account>

now I'am trying to create the xls file.

This is my xls file....

<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
            <METADATA>
                <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="WrntyID" TYPE="TEXT"/>
                <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="ExternalID" TYPE="TEXT"/>
                <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Name" TYPE="TEXT"/>            
            </METADATA>
            <RESULTSET>
                <ROW>
                    <COL>
                        <DATA><xsl:value-of select=“Account/Field[1]" /></DATA>
                    </COL>
                    <COL>
                        <DATA><xsl:value-of select=“Account/Field[2]” /></DATA>
                    </COL>
                    <COL>
                        <DATA><xsl:value-of select=“Account/Field[3]” /></DATA>
                    </COL>
                    </ROW>
            </RESULTSET>
        </FMPXMLRESULT>
    </xsl:template>
</xsl:stylesheet>

This instruction <xsl:value-of select=“Account/Field[1]"/> doesn't work.

What is the right syntax to retrive the value of the first TAG FIELD? Then the second end so on...?

Many thanks

Anna

 

Did you write your XSLT stylesheet in a word processor? Because the real problem with:

<xsl:value-of select=“Account/Field[1]" />

are the curly (smart) quotes surrounding the value of the select attribute. Replace them with regular quotes (Char (34)) and all will work as intended.

 

BTW, you could shorten the whole thing to:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/Account">
    <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
      <METADATA>
        <FIELD NAME="WrntyID"/>
        <FIELD NAME="ExternalID"/>
        <FIELD NAME="Name"/>            
      </METADATA>
      <RESULTSET>
        <ROW>
          <xsl:for-each select="Field">       
            <COL><DATA><xsl:value-of select="."/></DATA></COL>
          </xsl:for-each>
        </ROW>
      </RESULTSET>
    </FMPXMLRESULT>
  </xsl:template>
</xsl:stylesheet>

Note that this is assuming the source fields will always be in the given order - as does your stylesheet. Otherwise you will need to select the fields by their APIName attribute, rather than by their position.

 

Edited by comment

  • Author

Hi,

With regular quotes it works!

How Can I select the fields by its APIName attribute?

Anna

 

22 minutes ago, Anna.anto said:

How Can I select the fields by its APIName attribute?

Like this:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/Account">
  <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
    <METADATA>
      <FIELD NAME="WrntyID"/>
      <FIELD NAME="ExternalID"/>
      <FIELD NAME="Name"/>            
    </METADATA>
    <RESULTSET>
      <ROW>
        <COL><DATA><xsl:value-of select="Field[@APIName='WrntyID']"/></DATA></COL>
        <COL><DATA><xsl:value-of select="Field[@APIName='ExternalID']"/></DATA></COL>
        <COL><DATA><xsl:value-of select="Field[@APIName='Name']"/></DATA></COL>
      </ROW>
    </RESULTSET>
  </FMPXMLRESULT>
</xsl:template>

</xsl:stylesheet>

 

Edited by comment

  • Author

Great!

Thanks

Anna

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.