position() = last() problem

hi all

i am using position() = last() to test if a navon is the last one in the set so that i can add a class to the output. this works perfectly, unless the navon is the only element in the set - in this case my class is not added. is a single element in a set not the last one? does anybody know why this doesn’t work in this instance?

thanks
michelle

I’d have to see the source XML to be sure, but, in general, position() and last() are not specific to node names, instead they are relative to all top-level elements in the current context.

It may be helpful to re-define your context with an xsl:for-each (even if it may not be entirely necessary), where you select only the node elements you are interested in, forcing the context to contract and contain only what you are looking for. This will ensure that position() and last() have meanings relevant to what you are trying to accomplish.