L
Liam
I am totally new to XML and XSLT, so I I have an XML file of:
<log>
<logvalue code="500" description="desc" >
<logvalue code="510" description="desc" >
<logvalue code="504" description="desc" >
<logvalue code="1" description="desc" >
<logvalue code="503" description="desc" >
<log>
I want to process it using XSLT transform. I want to generate a table
as HTML output with the first column as a sequential value of rows. I
am using :-
<xsl:if test='count(//log/logvalue [@code>=500]) >
0'>
<xsl:if test='count(//log/logvalue
[@code<=510]) > 0'>
<table border="1">
<tr>
<th>Identifier</th>
<th>Code</th>
<th>Detail</th>
</tr>
<xsl:for-each select="//log/logvalue ">
<xsl:if test="@code>=500">
<xsl:if test="@code<=510">
<tr>
<td style="width:10%">
<xsl:number/>
</td>
<td style="width:30%">
<xsl:value-of
select=@code/>
</td>
<td style="width:60%">
<<xsl:value-of
select="@description"/>
</td>
</tr>
</xsl:if>
</xsl:if>
</xsl:for-each>
</table>
</xsl:if>
</xsl:if>
Now the Identifier column should display a sequential value for each
row that is printed but when I use <xsl:number/> it is the position in
the list rather than the incremental value as it is printed.
Can anyone help here?
Thanks,Liam
<log>
<logvalue code="500" description="desc" >
<logvalue code="510" description="desc" >
<logvalue code="504" description="desc" >
<logvalue code="1" description="desc" >
<logvalue code="503" description="desc" >
<log>
I want to process it using XSLT transform. I want to generate a table
as HTML output with the first column as a sequential value of rows. I
am using :-
<xsl:if test='count(//log/logvalue [@code>=500]) >
0'>
<xsl:if test='count(//log/logvalue
[@code<=510]) > 0'>
<table border="1">
<tr>
<th>Identifier</th>
<th>Code</th>
<th>Detail</th>
</tr>
<xsl:for-each select="//log/logvalue ">
<xsl:if test="@code>=500">
<xsl:if test="@code<=510">
<tr>
<td style="width:10%">
<xsl:number/>
</td>
<td style="width:30%">
<xsl:value-of
select=@code/>
</td>
<td style="width:60%">
<<xsl:value-of
select="@description"/>
</td>
</tr>
</xsl:if>
</xsl:if>
</xsl:for-each>
</table>
</xsl:if>
</xsl:if>
Now the Identifier column should display a sequential value for each
row that is printed but when I use <xsl:number/> it is the position in
the list rather than the incremental value as it is printed.
Can anyone help here?
Thanks,Liam