Can someone explain to me why I get the following output by applying the following xsl file to the XML file.
<?xml version="1.0" encoding="ISO-8859-1"?>
<source>
<number>1</number>
<number>2</number>
<number>3</number>
<number>4</number>
<number>5</number>
<number>6</number>
<number>7</number>
<number>8</number>
</source>
======================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="number">
<p>
<xsl:value-of select="position()"/>
<xsl:text> of </xsl:text>
<xsl:value-of select="last()"/>
</p>
</xsl:template>
</xsl:stylesheet>
========================================
<p>2 of 17</p>
<p>4 of 17</p>
<p>6 of 17</p>
<p>8 of 17</p>
<p>10 of 17</p>
<p>12 of 17</p>
<p>14 of 17</p>
<p>16 of 17</p>
I do not quite understand why the output is not 1 out of 8, 2 out of 8, etc.
source
share