Re: [xsl] Parsing & Paths

Subject: Re: [xsl] Parsing & Paths
From: Jörg Heinicke <joerg.heinicke@xxxxxx>
Date: Sat, 20 Oct 2001 00:23:54 +0200
Hi Kris,

at first I want to show you a shorter example of your code:

<FILTERCOORDSYS>
    <xsl:attribute name="id">
        <xsl:value-of select="substring-after(/BoundingBox, '#')" />
    </xsl:attribute>
</FILTERCOORDSYS>

to so called 'attribute value template'

<FILTERCOORDSYS id="{substring-after(/BoundingBox, '#')}"/>

Then you must access the value of the attribute srsName of BoundingBox, not
boundingBox itself:

<FILTERCOORDSYS id="{substring-after(/BoundingBox/@srsName,'#')}"/>

<ENVELOPE minx="{/BoundingBox/gml:coord/gml:x}"
miny="{/BoundingBox/gml:coord/gml:x}"
maxx="{/BoundingBox/gml:coord/gml:x[2]}"
maxy="{/BoundingBox/gml:coord/gml:y[2]}"/>

With <xsl:value-of select=""> (or the attribute value template used above)
you get the value of the first occurence of the XPATH-expression. So you
must not write minx="{/BoundingBox/gml:coord/gml:x[1]}". The [2] (or [1]) is
the same like [position() = 2] and '[]' is a filter for the selected nodes.
So [2] selects the value of the second occurence of the node.

For more information about XSLT and XPATH look at
http://www.zvon.org/xxl/XSLTreference/Output/index.html,
http://www.topxml.com/xsl/xsltref.asp,
http://www.topxml.com/xsl/XPathRef.asp or
http://www.mulberrytech.com/xsl/index.html (links).

Hope this helps,

Joerg


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread