Jump to content

How do I know if an element is the last of its kind


javajoemorgan

Recommended Posts

How do I know if an element is the last of its kind in the entire document...For example, I think this gets the last HEADING element in the doc//HEADING[last()] So, If I'm within the HEADING template, how do I basically write:<xsl:if test="self = //HEADING[last()]">.......It seems like //HEADING[last()] is always returning the last heading relative to it's level.----------------Follow-Up: OK... through experimentation, I've proved that //HEADING[last()] is always returing the last element on the first level rather than anywhere in the document. How does one get the last element, regardless of it's level of nesting.

<X>  <B>	<A>1	  <A>2</A>	</A>  </B>  <C>	<D>	   <A>3</A>	</D>  </C></X>

I would suspect that //A[last()] would return A3, but it returns A1.... Why? and how do you generically get to A3.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...