tags:

views:

827

answers:

1

How can I retrieve the position of the current Para?

<xsl:template match="Para">
 <xsl:variable name="PositionInDocument" select="What do I do here?" />
</xsl:template>

This is the xml document:

<QuestionStem>Question </QuestionStem>
<Para>This is my paragraph question.</Para>
<Para>Thisis another para for question.</Para>
<AnswerListItem>Answer</AnswerListItem>
<Para>This is my answer paragraph</Para>
<Para>This is another answer paragraph</Para>
<SubAnswerBulleted>Sub Answer Bulleted</SubAnswerBulleted>
<Para>This is a paragraph that is part of a sub answer.</Para>
<SubSubAnswerNumbered>Sub Sub Answer Numbered</SubSubAnswerNumbered>
<Para>This is a paragraph that is part of a sub sub answer.</Para>
<SubSubAnswerNumbered>Sub Sub Answer</SubSubAnswerNumbered>
<SubSubAnswerNumbered>Sub Sub Answer</SubSubAnswerNumbered>
<SubAnswerBulleted>Sub Answer Bulleted</SubAnswerBulleted>
<SubAnswerBulleted>Sub Answer</SubAnswerBulleted>
+5  A: 

position()

See this

efficientjelly
I do not know how to apply that to this situation.
joe
Just substitute `"position()"` for `"What do I do here?"` in your snippet and `PositionInDocument` will be set to the posititon of the current node within its parent node!
efficientjelly
Thanks, how would I get the position of a following sibling?http://stackoverflow.com/questions/317741/how-do-i-select-the-position-of-a-following-sibling
joe