im using xsl to dynamically populate a drop down list. the XML is basically a list of names with an ID number. I can populate the list properly if i know how many entrys there are in the XMl document but what i really need is to use a loop so it stops making the drop down list when the id = "x" to mark the end of the file. here is my code so far:
Kenneth Birney
User Interface Programmer
Scottish Police
Code:
<xsl:element name="Select">
<xsl:attribute name="NAME">status</xsl:attribute>
<xsl:attribute name="size">1</xsl:attribute>
<xsl:element name="option">
<xsl:attribute name="value"><xsl:value-of select="ID"/></xsl:attribute>
<xsl:attribute name="selected"/>
<xsl:for-each select="details/person[id= 1]">
<xsl:value-of select="FirstName"/> <xsl:value-of select="LastName"/>
</xsl:for-each>
</xsl:element>
<xsl:element name="option">
<xsl:attribute name="value"><xsl:value-of select="ID"/></xsl:attribute>
<xsl:attribute name="selected"/>
<xsl:for-each select="details/person[id= 2]">
<xsl:value-of select="FirstName"/> <xsl:value-of select="LastName"/>
</xsl:for-each>
</xsl:element>
<xsl:element name="option">
<xsl:attribute name="value"><xsl:value-of select="ID"/></xsl:attribute>
<xsl:for-each select="details/person[id= 3]">
<xsl:value-of select="FirstName"/> <xsl:value-of select="LastName"/>
</xsl:for-each>
</xsl:element>
</xsl:element>
User Interface Programmer
Scottish Police