The following XSLT creates an HTML table with the respective selected item marked.
The item in question can be passed as
id
parameter from your xslt processor - default is 677.
="1.0"="utf-8"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:param name="id">677</xsl:param>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/PersonsList">
<table border="1">
<tr>
<th>Id</th>
<th>Name</th>
<th>Selected</th>
</tr>
<xsl:for-each select="person">
<xsl:sort select="id" order="ascending" data-type="number"/>
<tr>
<td>
<xsl:value-of select="id"/>
</td>
<td>
<xsl:value-of select="name"/>
</td>
<td>
<xsl:choose>
<xsl:when test="id=$id">yes</xsl:when>
<xsl:otherwise>no</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
Output:
<table border="1">
<tr>
<th>Id</th>
<th>Name</th>
<th>Selected</th>
</tr>
<tr>
<td>444</td>
<td>peter</td>
<td>no</td>
</tr>
<tr>
<td>677</td>
<td>Amanda</td>
<td>yes</td>
</tr>
<tr>
<td>1233</td>
<td>john</td>
<td>no</td>
</tr>
</table>
Id | Name | Selected |
444 | peter | no |
677 | Amanda | yes |
1233 | john | no |
Please note that XSLT requires functional programming style, not procedural programming style. Main reason is, that you can only initialize variables, but not assign new values to variables.
Cheers
Andi