[Gdal-dev] [OGR] Parsing GML using XSLT

Benoit Myard myardbenoit at gmail.com
Wed May 23 04:46:58 EDT 2007


Hi list,

I guess I'm missing something but I haven't been able to successfully
parse OGR's GML with XSLT.

Sample OGR/GML file:

<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://ogr.maptools.org/lightnings.xsd"
     xmlns:ogr="http://ogr.maptools.org/"
     xmlns:gml="http://www.opengis.net/gml">
  <gml:boundedBy>
    <gml:Box>
      <gml:coord><gml:X>366874</gml:X><gml:Y>2130603</gml:Y></gml:coord>
      <gml:coord><gml:X>387709</gml:X><gml:Y>2166975</gml:Y></gml:coord>
    </gml:Box>
  </gml:boundedBy>
  <gml:featureMember>
    <ogr:lightning fid="F0">
      <ogr:geometryProperty><gml:Point><gml:coordinates>371000,2
149000</gml:coordinates></gml:Point></ogr:geometryProperty>
      <ogr:rowid>42</ogr:rowid>
      <ogr:date>2007/01/21 01:16:45</ogr:date>
      <ogr:nbstrokes>16</ogr:nbstrokes>
      <ogr:amplitude>-1337</ogr:amplitude>
    </ogr:lightning>

Sample XSL file:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:gml="http://www.opengis.net/gml"
        xmlns:ogr="http://gdal.velocet.ca/ogr"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xsl:output method="text" />

<xsl:template match="ogr:lightning">
  <xsl:value-of select="@fid" />
</xsl:template>

</xsl:stylesheet>

It seems to be related with the ogr namespace since the gml namespace
doesn't cause any problem. Any hints ?

Thanks.

-- 
Benoit Myard



More information about the Gdal-dev mailing list