xsl-list
[Top] [All Lists]

RE: [xsl] Problem getting position of node

2006-03-21 01:47:39
Hi, 

      Iam attempting to append the position of the current 
node to  the value of each of the node's attributes but Iam 
having problems in achieving this.

Iam getting the following error:

Error at xsl:value-of on line 27 of file:/D:/xamp.xsl:
 Error in expression concat(., parent::node()/position()): 
Unexpected token [<function>] in path expression


The line causing the problem is

<xsl:attribute name="{name(.)}">
<xsl:value-of select="concat(., parent::node()/position())"/> 

parent::node()/position() is the problem, you can't use a function as a right 
side operator in a path expression. Also, position() does not return the 
position of a node in it's siblings, but rather the context position. You want

  <xsl:value-of select="."/>
  <xsl:number count="*"/>

Cheers,

Jarno

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