How do I exit a "for-each" loop in XSL if a condition is satisfied? e.g. Suppose I want the XSL to display the address of apartments which have (2 bedrooms and rent <= 1000), in the following XML, the following XSL code:
<xsl:for-each select="//apartment/apartment_details">
<xsl:if test="bedrooms=$bedrooms and rent <= $budget ">
<!--display apartment address-->
</xsl:if>
</xsl:for-each>
would return the same apartment address twice. I want to display the apartment address only once even if there are multiple for the apartment that satisfy the condition.
XML structure:
<apartments>
<apartment>
<address>
<street>....</street>
<city>....</city>
</address>
<apartment_details>
<bedrooms>2</bedrooms>
<bathrooms>2</bathrooms>
<rent>1000</rent>
</apartment_details>
<apartment_details>
<bedrooms>2</bedrooms>
<bathrooms>1</bathrooms>
<rent>900</rent>
</apartment_details>
...
</apartment>
...
</apartments>
Thank you.