xsl-list
[Top] [All Lists]

Re: finding postion from value of attribute

2003-10-21 05:30:08
Please try the following Template definition --

<xsl:template match="/question">
  <xsl:for-each select="answer">
    <xsl:if test="@eval">
      Position of node (having eval attribute) --
<xsl:value-of select="position()" />
    </xsl:if>  
  </xsl:for-each>
</xsl:template>

I hope the answer is useful..

Regards,
Mukul

--- David Elsmore <delsmore(_at_)brookes(_dot_)ac(_dot_)uk> wrote:
Hi,

I have the following xml input and would like to
identify the position 
of the <answer/> element with the 'correct'
attribute within the 
<question/> context and output it as as an integer (
in this case 3).

<question>
    <answer/>
    <answer/>
    <answer eval="correct">
    <answer/>
</question>

Any suggestions much appreciated

David Elsmore



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



__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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



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