RE: [xsl] patterns

Subject: RE: [xsl] patterns
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Fri, 4 Apr 2003 13:34:25 -0500
[ Terence]

 Hopefully I will eventually do enough XSL/Xpath to
> actually understand it when I come back and read it again some time.
> 
> Anyway, I have a question...
> 
> Why doesn't this work?
> <xsl:value-of
> select="./ceiling((endODBCDate/@unixTS - 
> startODBCDate/@unixTS) div 60)"
> />
> 
> Sablotron says
> "pattern is empty"

  What you need in not an answer to this question but to learn how to
solve this kind of problem.

One way is to run another processor to try to get a more helpful error
message.  Saxon says

"Error in expression ./ceiling((endODBCDate/@unixTS -
startODBCDate/@unixTS) div 60): Unexpected token [<function>] in path
expression"

A second approach is to simplify.  Using

<xsl:value-of select="./ceiling(1)"/>

gives the same result.

So obviously it is the pattern and not the context node that is at
fault.  In fact, the cuprit is the leading "./".  A node  or path
specification has to follow this path expression, but you have a
function (ceiling()) instead.

You never need to use "./" anyway even for a path expression (this is
not unix, after all)  - since it is implied when you just write a node
name - just remove it and then the processor will not expect a path
expression -

<xsl:value-of select="ceiling((endODBCDate/@unixTS -
startODBCDate/@unixTS) div 60)

Cheers,

Tom P




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


Current Thread
  • [xsl] patterns
    • Terence - Sat, 05 Apr 2003 03:18:37 +1000
      • <Possible follow-ups>
      • Passin, Tom - Fri, 4 Apr 2003 13:34:25 -0500 <=