Hello all. This is now my third, and definitely final request for help as my project is now only this step away from being completed.
It's been a while since I dealt with this particular XSLT file as I have been programming the rest of the site and other translations (like for KML files etc).
Now my problem has come about because the format for holding position coordinates (eastings, northings, altitudes etc) has changed with one of the XML applications I make use of, diggs.
Basically before the data was held like this (making use of GML):
Code:
<gml:Point>
<gml:pos>316865 504940</gml:pos>
</gml:Point>
And I then used a different element to hold the altitude value.
I used the following function to separate those two coordinates:
Code:
<xsl:function name="geo:point" as="xs:integer+">
<xsl:param name="location" as="element(geo:location)"/>
<xsl:variable name="point" as="xs:string" select="$location/gml:Point[@srsName='EPSG:27700']/gml:pos"/>
<xsl:sequence select="xs:integer(substring-before($point, ' '))"/>
<xsl:sequence select="xs:integer(substring-after($point, ' '))"/>
</xsl:function>
The variable inside of the template would then be something like:
Code:
<xsl:variable name="crest" as="xs:integer+" select="geo:point(geo:slope/geo:crest/geo:location)"/>
This could then be accessed with code like $crest[1] and $crest[2].
Now I am having to deal with the following XML:
Code:
<gml:LineString srsName="urn:ogc:def:crs:epsg:6.9:27700" srsDimension="3" gml:id="cl_BH11">
<gml:posList>316865 504940 749 407725 268614 -70</gml:posList>
</gml:LineString>
The attribute 'srsDimension' means that each coordinate has three dimensions, in this case (due to the srsName specified) it is an Easting, Northing and Altitude. So here there are two coordinates specified.
What I need to be able to do is break those values down so I can hold each value in a separate variable. So I have been trying to figure out how to use the tokenize function but I am failing miserably and figured it's probably very simple if you know how, so here I am asking for help! I tried to use something like the following code (to just deal with three values, not size) but it didnt work:
Code:
<xsl:function name="geo:point" as="xs:integer+">
<xsl:param name="location" as="element(geo:location)" />
<xsl:variable name="point" as="xs:string" select="$location/gml:Point/gml:pos" />
<xsl:sequence select="tokenize($point, ' ')" />
</xsl:function>
Saxon gives me an error with this of xsl:variable needing a '>' or a '/>' which makes no sense as it has '/>' on the end! But that's the sort of thing I'm looking for but for 6 values, and then hopefully I can use the function as I did with the old one.
Once I've sorted this then I have probably a couple of hours work max left to do on my project and then I get it up online and share with you. Will be interesting to hear what you think.
Many thanks (5am - not good!)