#4 position(), first() and last() for expressions

open
nobody
None
5
2004-05-07
2004-05-07
Anonymous
No

Thanks for the great software.

If you are looking for features, then I believe position(),
first() and last() would be useful. I'm not sure if these
require a full XPath implementation or not. I seem to run
into the need for them quite a bit. Example:

...
<xsl:if test="position()!=last()">
Not Last:
</xsl:if>
<xsl:if test="position()=last()">
Last Item:
</xsl:if>
...

Currently, I'm having to embed position attributes in the
source xml (yuck!). Can anyone suggest a better work
around?

Thanks,
Rudi

rudi@metratech.com

Discussion

  • Logged In: NO

    A better work around?

    Use XML::Twig.
    It's far more powerful