Skip 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.

KML import.

Featured Replies

  • Newbies

Hi All

 

Trying a relatively simple import of two text fields from some kml data but there's a mistake I'm not picking up. While I don't get any errors, I also don't get any records created. Any help would be appreciated.

 

XSLT:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/>

<xsl:template match="/">

<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="" NAME="" VERSION=""/>
<DATABASE DATEFORMAT="" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT=""/>

<METADATA>
<FIELD NAME="POSTCODE" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
<FIELD NAME="SHAPE" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
</METADATA>

<RESULTSET FOUND="">

<xsl:for-each select="Document/Folder/Placemark">
<ROW MODID="" RECORDID="">
<COL><DATA><xsl:value-of select="name"/></DATA></COL>
<COL><DATA><xsl:value-of select="Polygon/outerBoundaryIs/LinearRing/coordinates"/></DATA></COL>
</ROW>
</xsl:for-each>

</RESULTSET>
</FMPXMLRESULT>

</xsl:template>
</xsl:stylesheet>

 

XML sample:

<?xml version="1.0" encoding="iso-8859-1"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
<Document>
  <!-- Begin Style Definitions -->
  <Style id="area1">
    <LineStyle>
      <color>FF808080</color>
      <width>2</width>
    </LineStyle>
    <PolyStyle>
      <color>BF000000</color>
      <fill>0</fill>
      <outline>1</outline>
    </PolyStyle>
  </Style>
  <Folder>
    <name>Area Features</name>
    <description>Area Features</description>
    <Placemark>
      <description>County Subdivision</description>
      <name>0800</name>
      <styleUrl>#area1</styleUrl>
      <Polygon>
        <outerBoundaryIs>
          <LinearRing>
            <coordinates>
              130.8339472320,-12.4574101091,0
              130.8345397120,-12.4579840531,0
              130.8352064320,-12.4586632806,0
            </coordinates>
          </LinearRing>
        </outerBoundaryIs>
      </Polygon>
    </Placemark>
    <Placemark>
      <description>County Subdivision</description>
      <name>0810</name>
      <styleUrl>#area1</styleUrl>
      <Polygon>
        <outerBoundaryIs>
          <LinearRing>
            <coordinates>
              130.8458432320,-12.4026033781,0
              130.8523644480,-12.4025805491,0
              130.8523654720,-12.4026570836,0
            </coordinates>
          </LinearRing>
        </outerBoundaryIs>
      </Polygon>
    </Placemark>

  </Folder>
</Document>
</kml>

 

Solved by comment

Go to solution
  • Solution

I see two problems with your stylesheet:

 

First, the root element of your XML source is <kml> so the reference to "Document/Folder/Placemark" doesn't find anything.

 

The other issue is that the root element (and consequently all of its children) lives in its own namespace, so you must define a prefix for this namespace and use it when calling any element - something like:

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:k="http://www.opengis.net/kml/2.2"
exclude-result-prefixes="k">

<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>

<xsl:template match="/">

<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="" NAME="" VERSION=""/>
<DATABASE DATEFORMAT="" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT=""/>

<METADATA>
<FIELD NAME="POSTCODE" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
<FIELD NAME="SHAPE" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT=""/>
</METADATA>

<RESULTSET FOUND="">

<xsl:for-each select="k:kml/k:Document/k:Folder/k:Placemark">
<ROW MODID="" RECORDID="">
<COL><DATA><xsl:value-of select="k:name"/></DATA></COL>
<COL><DATA><xsl:value-of select="k:Polygon/k:outerBoundaryIs/k:LinearRing/k:coordinates"/></DATA></COL>
</ROW>
</xsl:for-each>

</RESULTSET>
</FMPXMLRESULT>

</xsl:template>
</xsl:stylesheet>

 

 

 

  • Author
  • Newbies

Thanks for that. I now have a nice set of data for visualising survey response stats in Google maps and a good idea of which XML tutorials I need to do next  :wink:

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

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.