XSLT Question: using the starts-with() string function

Roger L. Costello costello at mitre.org
Mon Jun 21 17:43:46 BST 1999

Hi folks,

I am having some trouble using XSLT's starts-with() string function.
Below is a snippet of some XML:

    ICAO: Boston
    LatLon: 74.31W, 106.5N

Note how the content of the <location> element either starts with ICAO
or with LatLon.  

I would like to write a template rule for the <location> element 
that checks to see what its content starts with.  If it starts with
ICAO then it should do one thing.  It is starts with LatLon it
should do another thing.  Here is my (failed) attempt at this template

<xsl:template match="location" >
    <xsl:if test="starts-with('./text()','ICAO')">
    <xsl:if test="starts-with('./text()','LatLon')">

When I run this through James Clark's XT processor I get no output
for this template rule.  What am I doing wrong?

Also, I found that if I user the xsl:choose construct (rather than 
the sequence of xsl:if statements) I get an "invalid token" error 
message.  Anyone know that that's all about?


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)

More information about the Xml-dev mailing list