I know about GPSbabel and have used it for transforming GPX files into CSV that I can then import into Filemaker Pro for manipulation. However, I'd like to be able to import GPX files more simply & neatly into FMP and hoped I could write a XSL stylesheet to convert the GPX form of XML to the FMPXMLRESULT grammar.

I'm looking at GPX files from Garmin Foretrex, Dakota, Nuvi & GPSmap296 devices. My latest attempt at a XSL stylesheet (using snippets cribbed from various examples) looks like:

```
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent="yes" method="xml"/>
    <xsl:template match="trkseg">
        <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
            <ERRORCODE>0</ERRORCODE>
            <PRODUCT BUILD="01-25-2011" NAME="FileMaker" VERSION="ProAdvanced 11.0v3"/>
            <DATABASE DATEFORMAT="Yyyy-m-d" LAYOUT="" NAME="gpx_import_test.fp7" RECORDS="{@count}"
                TIMEFORMAT="k:mm:ss "/>
            <METADATA>
                <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="ele" TYPE="NUMBER"/>
                <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="lat" TYPE="NUMBER"/>
                <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="lon" TYPE="NUMBER"/>
                <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="time_text" TYPE="TEXT"/>
            </METADATA>
            <RESULTSET FOUND="@count">
                <xsl:for-each select="trkpt">
                    <ROW MODID="0" RECORDID="{position()}">
                        <COL>
                            <DATA>
                                <xsl:value-of select="lat"/>
                            </DATA>
                        </COL>
                        <COL>
                            <DATA>
                                <xsl:value-of select="lon"/>
                            </DATA>
                        </COL>
                        <COL>
                            <DATA>
                                <xsl:value-of select="ele"/>
                            </DATA>
                        </COL>
                        <COL>
                            <DATA>
                                <xsl:value-of select="time_text"/>
                            </DATA>
                        </COL>
                    </ROW>
                </xsl:for-each>
            </RESULTSET>
        </FMPXMLRESULT>
    </xsl:template>
</xsl:stylesheet>

```

When I try to use the above stylesheet, FMP complains "XML parsing error: invalid document structure".

I'd welcome any suggestions - I guess I'm making some very simple and obvious error.

regards

Rowland

Here is a snipped version of a typical GPX file from a Garmin Dakota 20 that I am trying to import.

```
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1"
xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3"
xmlns:wptx1="http://www.garmin.com/xmlschemas/WaypointExtension/v1"
xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1"
creator="Dakota 20" version="1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1
http://www.topografix.com/GPX/1/1/gpx.xsd
http://www.garmin.com/xmlschemas/GpxExtensions/v3
http://www8.garmin.com/xmlschemas/GpxExtensionsv3.xsd
http://www.garmin.com/xmlschemas/WaypointExtension/v1
http://www8.garmin.com/xmlschemas/WaypointExtensionv1.xsd
http://www.garmin.com/xmlschemas/TrackPointExtension/v1
http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd">
<metadata>
<link href="http://www.garmin.com">
<text>Garmin International</text>
</link>
<time>2011-10-21T16:55:50Z</time>
</metadata>
<trk>
<name>Current Track: 20 OCT 2011 10:31</name>
<extensions>
<gpxx:TrackExtension>
<gpxx:DisplayColor>Black</gpxx:DisplayColor>
</gpxx:TrackExtension>
</extensions>
<trkseg>
<trkpt lat="51.6084605176" lon="-2.2182025295">
<ele>43.40</ele>
<time>2011-10-20T09:31:44Z</time>
</trkpt>
<trkpt lat="51.6084605176" lon="-2.2182025295">
<ele>47.24</ele>
<time>2011-10-20T09:31:53Z</time>

</trkpt>
</trkseg>
</trk>
</gpx>

```