xsl-list
[Top] [All Lists]

[xsl] invalid xpath?

2008-07-02 03:24:40
The following template errors in xsltproc and XMLSpy but appears to function
correctly when run by Saxon.

<!-- retain leading and trailing WS, remove line-breaks from the rest -->
<!-- special case for initial text, or text following <nl> element, when it
starts with a NL -->
<xsl:template name="KeepWS">
 <xsl:param name="Arg" select="." />
 <xsl:variable name="tArg">
  <xsl:choose>
   <xsl:when
test="preceding-sibling::*[1][self::nl][starts-with($Arg,'&#x0a;')]">
    <xsl:call-template name="WS">
     <xsl:with-param name="Arg" select="substring($Arg,2)" />
    </xsl:call-template>
   </xsl:when>
   <xsl:when test="not(preceding-sibling::*)[starts-with($Arg,'&#x0a;')]">
    <xsl:call-template name="WS">
     <xsl:with-param name="Arg" select="substring($Arg,2)" />
    </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
    <xsl:call-template name="WS">
     <xsl:with-param name="Arg" select="$Arg" />
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:variable>
 <xsl:value-of select="$tArg" />
</xsl:template>

The xsltproc error is "XPath error: Invalid type"
XMLSpy says "Error in XPath expression, Not a node set"

I thought the test expressions are valid v1.0 XSL. Is this not so?

Cheers
Trevor



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>