[xml] xpath return type
- From: Stefan Seefeld <seefeld sympatico ca>
- To: xml gnome org
- Subject: [xml] xpath return type
- Date: Mon, 16 Feb 2004 16:11:20 -0500
hi there,
I'v been puzzled by an xslt expression that didn't do what
I thought it should. I'd highly appreciate if anybody could
help me understand the current behavior:
I'v the following xml file:
<?xml version='1.0'?>
<root>
<message value="1">hello world</message>
</root>
and the following stylesheet:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<xsl:template match="root">
<xsl:variable name="var" select="//message[ value='1']"/>
<xsl:message>value:<xsl:value-of select="$var"/></xsl:message>
<xsl:message>starts with 'hello':<xsl:value-of
select="starts-with('hello', $var)"/></xsl:message>
<xsl:message>remainder:<xsl:value-of select="substring-after($var,
'hello')"/></xsl:message>
</xsl:template>
</xsl:stylesheet>
Running xsltproc on these two gives the following output:
value:hello world
starts with 'hello':false
remainder: world
I would expect the 'starts-with' test to return 'true'. What is going
on here ?
Thanks,
Stefan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]