Jump to content

Breaking a for-each


netuh

Recommended Posts

Hi,Someone know how break a for-each?example:

<?xml version="1.0"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="xml" indent="yes"/><xsl:template match="/"><foo>	<xsl:for-each select="/thing">		<xsl:if test="name = 'moo' ">			<moo/>		</xsl:if>   	</xsl:for-each></foo></xsl:template></xsl:stylesheet>

And when the if be true, the tag <moo/> is placed. But i want that when place the tag <moo/>, the for-each stop. Someone can help me?Thanks.

Link to comment
Share on other sites

How about a predicate in the for-each?

	<xsl:for-each select="/thing[name='moo']">			<moo/>	</xsl:for-each>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...