You haven't really posted enough of your stylesheet to explain the
behaviour that you get.
<xsl:template match="term[string(.)='s' or string(.)='s.']">
That's OK althouth you could write it as
<xsl:template match="term[.='s' or .='s.']">
as comparing nodes to strings always uses the string value.
However
<xsl:variable name="pos" select="position()+2"/>
It's impossible to say what $pos will be here (and so how the rest of
the template behaves).
As mentioned often on this list (eg yesterday) position() never relates
to the position of a node in the source tree, only to its position in
the current node list, which in this case means it depends on the select
attribute of the xsl:apply-templates that causes this template to fire.
For example, just looking at the first keyword element.
if it had <xsl:apply-templates select="term[.='s.']"/>
then position() would be 1 and $pos 3
if it had <xsl:apply-templates select="term"/>
then position() would be 2 and $pos 4
if it had <xsl:apply-templates/>
then position() would be 6 and $pos 8 (because of the white space text
nodes between each child element of keyword) unless keyword was listed
in <xsl:strip-space elements="keyword" in which case it would act as
if it had <xsl:apply-templates select="*"/>
then position() would be 3 and $pos 5
David
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________