Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8761557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:18:49+00:00 2026-06-13T15:18:49+00:00

I’m trying to export some data from our Filemaker Database and transform it via

  • 0

I’m trying to export some data from our Filemaker Database and transform it via XSLT

I have got most of the way but am getting stuck at some nested data:

Current structure of the XML output is:

    <?xml version="1.0" encoding="UTF-8"?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
    <ERRORCODE>0</ERRORCODE>
    <PRODUCT BUILD="07-18-2011" NAME="FileMaker" VERSION="ProAdvanced 11.0v4"/>
    <DATABASE DATEFORMAT="D/m/yyyy" LAYOUT="" NAME="bubbles.fp7" RECORDS="34604" TIMEFORMAT="k:mm:ss "/>
    <METADATA>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="description intro" TYPE="TEXT"/>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Description Line 1" TYPE="TEXT"/>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Description Line 2" TYPE="TEXT"/>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="description short" TYPE="TEXT"/>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="description W3" TYPE="TEXT"/>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Destination URL" TYPE="TEXT"/>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="EAN Code" TYPE="TEXT"/>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product code W1" TYPE="TEXT"/>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product group name" TYPE="TEXT"/>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product name W6" TYPE="TEXT"/>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="stock_for_sale_quantity" TYPE="NUMBER"/>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="UPC Code" TYPE="NUMBER"/>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="web link standard" TYPE="TEXT"/>
        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="products_ADDITIONAL_IMAGES::full url" TYPE="TEXT"/>
    </METADATA>
    <RESULTSET FOUND="6">
        <ROW MODID="5678" RECORDID="5051">
            <COL>
                <DATA>description info here</DATA>
            </COL>
            <COL>
                <DATA> desc line 1</DATA>
            </COL>
            <COL>
                <DATA>desc line 2</DATA>
            </COL>
            <COL>
                <DATA>short description here</DATA>
            </COL>
            <COL>
                <DATA>
Reall long description goes in here</DATA>
            </COL>
            <COL>
                <DATA>url to product</DATA>
            </COL>
            <COL> 
                <DATA/>
            </COL>
            <COL>
                <DATA>SKU</DATA>
            </COL>
            <COL>
                <DATA>Acoustic guitars</DATA>
            </COL>
            <COL>
                <DATA>Epiphone EJ-200 Acoustic Guitar Vintage Sunburst EJ200</DATA>
            </COL>
            <COL>
                <DATA>0</DATA>
            </COL>
            <COL>
                <DATA>711106264509</DATA>
            </COL>
            <COL>
                <DATA>http://www.mywebsite.co.uk/catalog/product/view/id/15186</DATA>
            </COL>
            <COL>
                <DATA>http://www.mywebsite.co.uk/store/images/uploads/additional/epiej200vsbrst_01.jpg</DATA>
                <DATA>http://www.mywebsite.co.uk/store/images/uploads/additional/epiej200vsbrst_02.jpg</DATA>
                <DATA>http://www.mywebsite.co.uk/store/images/uploads/additional/epiej200vsbrst_03.jpg</DATA>
                <DATA>http://www.mywebsite.co.uk/store/images/uploads/additional/epiej200vsbrst_04.jpg</DATA>
                <DATA>http://www.mywebsite.co.uk/store/images/uploads/additional/epiej200vsbrst_05.jpg</DATA>
                <DATA>http://www.mywebsite.co.uk/store/images/uploads/additional/epiej200vsbrst_06.jpg</DATA>
                <DATA>http://www.mywebsite.co.uk/store/images/uploads/epiej200vsbrst.jpg</DATA>
            </COL>
        </ROW>

My XSL is working to a certain extent, but I can’t quite get it to pick out each of the images:

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/fmpxmlresult" version="1.0" exclude-result-prefixes="fmp">
<xsl:output method="xml" version="1.0" encoding="windows-1251" indent="yes"/>
<xsl:template match="/">
    <product>
        <product_count>
            <xsl:value-of select="count(//fmp:ROW)"/>
        </product_count>
        <xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">
            <product_info>
                <description_info>
                    <xsl:value-of select="fmp:COL[1]/fmp:DATA"/>
                </description_info>
                <desc_line_1>
                    <xsl:value-of select="fmp:COL[2]/fmp:DATA"/>
                </desc_line_1>
                <desc_line_2>
                    <xsl:value-of select="fmp:COL[3]/fmp:DATA"/>
                </desc_line_2>
                <short_description>
                    <xsl:value-of select="fmp:COL[4]/fmp:DATA"/>
                </short_description>
                <long_description>
                    <xsl:value-of select="fmp:COL[5]/fmp:DATA"/>
                </long_description>
                <dest_url>
                    <xsl:value-of select="fmp:COL[6]/fmp:DATA"/>
                </dest_url>
                <ean>
                    <xsl:value-of select="fmp:COL[7]/fmp:DATA"/>
                </ean>
                <sku>
                    <xsl:value-of select="fmp:COL[8]/fmp:DATA"/>
                </sku>
                <group_name>
                    <xsl:value-of select="fmp:COL[9]/fmp:DATA"/>
                </group_name>
                <product_name>
                    <xsl:value-of select="fmp:COL[10]/fmp:DATA"/>
                </product_name>
                <stock_level>
                    <xsl:value-of select="fmp:COL[11]/fmp:DATA"/>
                </stock_level>
                <upc>
                    <xsl:value-of select="fmp:COL[12]/fmp:DATA"/>
                </upc>
                <web_link>
                    <xsl:value-of select="fmp:COL[13]/fmp:DATA"/>
                </web_link>
                <position>
                    <xsl:value-of select="fmp:DATA"/>
                </position>
                <images>
                    <xsl:variable name="count" select="count(fmp:COL[14]/fmp:DATA)"/>
                    <image_count>
                        <xsl:value-of select="$count"/>
                    </image_count>
                    <xsl:for-each select="fmp:COL[14]/fmp:DATA[position()&lt;=$count]">
                        <img>
                            <xsl:value-of select="position()"/>
                        </img>
                    </xsl:for-each>
                </images>
            </product_info>
        </xsl:for-each>
    </product>
</xsl:template>

This works except for the bit which gives me the correct number of tags, but no data

    <images>
        <image_count>7</image_count>
        <img/>
        <img/>
        <img/>
        <img/>
        <img/>
        <img/>
        <img/>
    </images>

Anyone able to help be with the last little loop ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:18:50+00:00Added an answer on June 13, 2026 at 3:18 pm

    You’re making things much more complicated than you need to:

    <xsl:for-each select="fmp:COL[14]/fmp:DATA">
      <img>
        <xsl:value-of select="."/>
      </img>
    </xsl:for-each>
    

    will give you

    <img>http://www.absolutemusic.co.uk/store/images/uploads/additional/epiej200vsbrst_01.jpg</img>
    <img>http://www.absolutemusic.co.uk/store/images/uploads/additional/epiej200vsbrst_02.jpg</img>
    ....
    

    As an aside, I’ve had to write filemaker XSLTs in the past and to keep myself sane (and not have to remember the right column indexes for each field) I’ve used a trick like this:

    <xsl:variable name="mdf" select="/fmp:FMPXMLRESULT/fmp:METADATA/fmp:FIELD" />
    <xsl:variable name="descIntro" select="count($mdf[
        following-sibling::fmp:FIELD/@NAME = 'description intro']) + 1" />
    <xsl:variable name="descL1" select="count($mdf[
        following-sibling::fmp:FIELD/@NAME = 'Description Line 1']) + 1" />
    

    and so on. This creates a variable for each field name containing the correct index for that field, so you can then use expressions like fmp:COL[$images] instead of fmp:COL[14]. This has the additional advantage that if you later change the export definition to include additional fields the XSLT automatically compensates, you don’t have to modify all the numbers by hand.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view passing on information from a database: def serve_article(request, id): served_article
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a reasonable size flat file database of text documents mostly saved in
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.