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 8356707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:16:01+00:00 2026-06-09T10:16:01+00:00

I have an XML that looks the Below. I am trying to fill a

  • 0

I have an XML that looks the Below.

I am trying to fill a filemaker record with all the values from each of the Image node attributes.

However notice that within the XML presented, if a Image node is used more than once, defined by its file id , its subsequent children’s elements are not present.

I have the current sample xsl below that is basically working but I would like to add a conditional evaluation to the stylesheet that says:
In English:
if the ‘key’ element does not exist the find the first preceding matching and use the values from those elements. The same would apply for the ‘string and ‘reel’ elements.

The result will fill each records columns with all the relevant data instead of what is now sometimes only partial data for such duplicated files.

Apologies for my poor description.

Any help will be greatly appreciated.

XML:

<?xml version="1.0"?>
<xmeml>
<boxset>
<stream>
    <track>
        <image>
            <start>0</start>
            <end>90</end>
            <file id="abcde">
                <key>95</key>
                <string>1023</string>
                <time>
                    <reel>142</reel>
                </time>
            </file>
        </image>
        <image>
            <start>90</start>
            <end>120</end>
            <file id="bcdef">
                <key>55</key>
                <string>1023</string>
                <time>
                    <reel>64</reel>
                </time>
            </file>
        </image>
    </track>
    <track>
        <image>
            <start>120</start>
            <end>130</end>
            <file id="abcde"/>
        </image>
        <image>
            <start>130</start>
            <end>180</end>
            <file id="cdefg">
                <key>92</key>
                <string>1023</string>
                <time>
                    <reel>194</reel>
                </time>
            </file>
        </image>    
    </track>
</stream>
</boxset>
</xmeml>

XSLT:

<?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">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="11/13/2002" NAME="Filemaker Pro" VERSION="6.0V4"/>
<DATABASE DATEFORMAT="d/M/yyyy" LAYOUT="" NAME="combotest.fp7" RECORDS="" TIMEFORMAT="h:mm:ss a"/>
<METADATA>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="start" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="end" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="fileID" TYPE="TEXT"/>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="key" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="string" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="reel" TYPE="NUMBER"/>
</METADATA>
<xsl:for-each select=" //image ">


<RESULTSET FOUND="">

<ROW MODID="" RECORDID="">

<COL><DATA><xsl:value-of select="./start" /></DATA></COL>
<COL><DATA><xsl:value-of select="./end" /></DATA></COL>
<COL><DATA><xsl:value-of select="./file/@id" /></DATA></COL>

<COL><DATA><xsl:value-of select="./file/key" /></DATA></COL>
<COL><DATA><xsl:value-of select="./file/string" /></DATA></COL>
<COL><DATA><xsl:value-of select="./file/time/reel" /></DATA></COL>

</ROW>

</xsl:for-each>


</RESULTSET></FMPXMLRESULT>
</xsl:template>
</xsl:stylesheet>

If the XML were to be filled they way Id like to see it it would look like this.

Ideal XML:

<?xml version="1.0"?>
<xmeml>
<boxset>
<stream>
    <track>
        <image>
            <start>0</start>
            <end>90</end>
            <file id="abcde">
                <key>95</key>
                <string>1023</string>
                <time>
                    <reel>142</reel>
                </time>
            </file>
        </image>
        <image>
            <start>90</start>
            <end>120</end>
            <file id="bcdef">
                <key>55</key>
                <string>1023</string>
                <time>
                    <reel>64</reel>
                </time>
            </file>
        </image>
    </track>
    <track>
        <image>
            <start>120</start>
            <end>130</end>
<!-- ideal data for repeated file "abcde" -->
            <file id="abcde">
                <key>95</key>
                <string>1023</string>
                <time>
                    <reel>142</reel>
                </time>
            </file>
<!-- end ideal repeated data -->
        </image>
        <image>
            <start>130</start>
            <end>180</end>
            <file id="cdefg">
                <key>92</key>
                <string>1023</string>
                <time>
                    <reel>194</reel>
                </time>
            </file>
        </image>    
    </track>
</stream>
</boxset>
</xmeml>
  • 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-09T10:16:03+00:00Added an answer on June 9, 2026 at 10:16 am

    You need to define a XSLT key to find file definition by its ID:

    <xsl:key name="file" match="file[*]" use="@id" />
    

    Here the [*] predicate ensures that only files with at least one child element will be indexed by their id. Since each file has only one such a definition, this is exactly what we need. Then you find the definition using the key() function:

    ...
    <COL><DATA><xsl:value-of select="./end" /></DATA></COL>
    <xsl:variable name="file" select="key('file', file/@id)" />
    <COL><DATA><xsl:value-of select="$file/@id" /></DATA></COL>
    <COL><DATA><xsl:value-of select="$file/key" /></DATA></COL>
    <COL><DATA><xsl:value-of select="$file/string" /></DATA></COL>
    <COL><DATA><xsl:value-of select="$file/time/reel" /></DATA></COL>
    ...
    

    XSLT keys are added at the top level of the stylesheet (i.e. among xsl:template, xsl:output, etc.).

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

Sidebar

Related Questions

I have a xml that looks like below <xsl:template match=//xml> <xsl:for-each select=//z:row> <ul class
I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I have an xml file that has an address node that looks like <address>
I have a xml that looks like below one. I need your help to
I am trying to extract data from xml file that looks like this (see
I have XML that looks like this: <Parameter Name=parameter name Value=parameter value /> which
I have XML that looks like this: <ROW ref=0005631 type=04 line=1 value=Australia/> <ROW ref=0005631
I have an XML file that looks like <?xml version=1.0> <playlist> <name>My Playlist</name> <song>
I have an XML structure that looks like: <Succeeded p1:type=Edm.Boolean xmlns:p1=http://schemas.microsoft.com/ado/2007/08/dataservices/metadata xmlns=http://schemas.microsoft.com/ado/2007/08/dataservices>false</Succeeded> Since I
I have an xml document that looks like this. <foo> <bar type=artist/> Bob Marley

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.