<?xml version="1.0"?>
<CarHistory>
<Type>Ford Sierra</Type>
<NoOfServices>3</NoOfServices>Ford Sierra
<ServiceDetails>
<ServiceNo>1</ServiceNo> <!-- note the count -->
<Date>01/09/2006</Date>
<Water>Filled</Water>
</ServiceDetails>
<ServiceDetails>
<ServiceNo>2</ServiceNo> <!-- note the count increase by 1 -->
<Date>01/09/2005</Date>
<Water>Filled</Water>
</ServiceDetails>
<ServiceDetails>
<ServiceNo>3</ServiceNo> <!-- note the count increase by 1 again and should do till end of services -->
<Date>01/09/2004</Date>
<Water>Filled</Water>
</ServiceDetails>
</CarHistory>
So far my xls looks like this
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<CarHistory>
<Type>
<xsl:choose><!-- Test to see if Type is there or if it has no value -->
<xsl:when test="Car/Type and '' != Car/Type"><!--If it is return the Value -->
<xsl:value-of select="Car/Type"/>
</xsl:when><!-- If its not return "Not Given" -->
<xsl:otherwise>Not Given</xsl:otherwise>
</xsl:choose>
</Type>
<NoOfServices>
<xsl:value-of select="count(Car/Service)"/>
</NoOfServices>
<xsl:apply-templates/>
</CarHistory>
</xsl:template>
<xsl:template match="Service">
<ServiceDetails>
<ServiceNo>
<!-- here lies the problem -->
</ServiceNo>
<Date>
<xsl:value-of select="Date"/>
</Date>
<Water>
<xsl:value-of select="Water"/>
</Water>
</ServiceDetails>
</xsl:template>
</xsl:stylesheet>
I wish to find the simplest way to have the <ServiceNo> incremnet by 1 each time around Position() does not seem to help me here as it increases by 2.