[xml] xpath return type

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'?>
  <message value="1">hello world</message>

and the following stylesheet:

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

<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>


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 ?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]