How to exit the "for everyone" cycle in XSL if the condition is met? For example, suppose XSL should display the address of apartments that have (2 bedrooms and rental <= 1000) in the following XML, the following XSL code:
<xsl:for-each select="//apartment/apartment_details">
<xsl:if test="bedrooms=$bedrooms and rent <= $budget ">
</xsl:if>
</xsl:for-each>
will return the same apartment address twice. I want to display the address of the apartment only once, even if for an apartment that satisfies the condition, several.
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.
source
share