Re: [xsl] selecting following attribute

Subject: Re: [xsl] selecting following attribute
From: Lars Huttar <lars_huttar@xxxxxxx>
Date: Fri, 17 Sep 2010 11:37:09 -0500
 On 9/17/2010 11:02 AM, Terry Ofner wrote:
> My question: How do I select the first following @startNum?
>
> This formulation 
>
> <xsl:value-of select="following::*/@startNum[1] -1"/>
>
> returns this error in Oxygen: Saxon B 9.0.0.6: A sequence of more than one item is not allowed as the first operand of '-'

I think besides what David Carlisle said, you could at least get better
typechecking by using number():

  <xsl:value-of select="number((following::*/@startNum)[1]) - 1"/>

Then if there was no following @startNum, the error would be thrown by number(). Or else you would get NaN?

Lars

Current Thread