Closed Bug 274544 Opened 20 years ago Closed 19 years ago

XSLT position() and last() functions

Categories

(Core :: XSLT, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 231715

People

(Reporter: andrey, Assigned: peterv)

Details

<?xml version="1.0"?>
<?xml-stylesheet type='text/xsl' href='test.xsl'?>
<Db>
<Row>test1</Row>
<Row>test2</Row>
<Row>test3</Row>
</Db>

<?xml version="1.0" encoding="windows-1251"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />

<xsl:template match="/">
<table border="1">
<xsl:apply-templates/>
</table>
</xsl:template>

<xsl:template match="Row">
<tr><td><xsl:value-of select="position()"/>
/<xsl:value-of select="last()"/>
</td>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:template>

</xsl:stylesheet>

In the Transformiix XSLT this gives result table
2 /7	test1
4 /7	test2
6 /7	test3

in others:
1 /3 test1 
2 /3 test2 
3 /3 test3 

Who is wrong?
We are right, <xsl:apply-templates/> includes whitespace nodes.
Check your spec for whitespace stripping.

<xsl:apply-templates select="Row"/> behaves like you expect.
Severity: critical → normal
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Actually

<xsl:apply-templates select="Db/Row"/>

is what you want. Alternativly use match="Db" in the template and select="Row"
Status: RESOLVED → VERIFIED
OK, thank you!
Status: VERIFIED → UNCONFIRMED
Resolution: INVALID → ---

*** This bug has been marked as a duplicate of 231715 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.