position() Problem with Lotus XML

Ben ben at thunderhouse.de
Tue Feb 1 09:51:25 GMT 2000


I have a problem that seems to be a bug in Lotus XSL. Just as likely I
have overlooked a mistake of mine.

The following code reproduces the problem:

in the problematic line (s.b.), position()+1 is not evaluated. If insead
of 'position()+1' I put a fixed position (e.g. '4'), everything works
ok. If I just output the position of each element('<xsl:value-of
select='position()'>'), everything is ok, too.
I also tried this with a variable for the position (see second code
example). In this case, the variable contains the right values if output
on it's own, but not as used in the example.

Any ideas of what I might have done wrong? Or is this really a bug in
Lotus XML?

<xsl:template match="area">
<xsl:for-each select="section">
<xsl:choose>
<xsl:when test="position() mod 2">
<tr>
<td>
<xsl:value-of select="@name"/>
</td>
<td>
<!-- PROBLEMATIC LINE -->
<xsl:value-of select="../section[position()+1]/@name"/>
</td>
</tr>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:for-each>
</xsl:template>

Second code example:

<xsl:template match="area">
<xsl:for-each select="section">
<xsl:variable name="var"><xsl:value-of
select="postion()+1"/></xsl:variable>
<xsl:choose>
<xsl:when test="position() mod 2">
<tr>
<td>
<xsl:value-of select="@name"/>
</td>
<td>
<xsl:value-of select="../section[$var]/@name"/>
</td>
</tr>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:for-each>
</xsl:template>



xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ or CD-ROM/ISBN 981-02-3594-1
Please note: New list subscriptions and unsubscriptions
are  now ***CLOSED*** in preparation for list transfer to OASIS.





More information about the Xml-dev mailing list