This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Break a for-each
- To: XSL-List at lists dot mulberrytech dot com
- Subject: [xsl] Break a for-each
- From: Stephane dot Le-Deaut at alcatel dot fr
- Date: Mon, 20 Aug 2001 10:47:59 +0200
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hello,
I have an XML file called "ReferenceAuthentified.xml" which contains some informations
like this :
<ReferenceAuthentified>
<SingleElement
SubsetName="HMBASE"
.....
</SingleElement>
....
</ReferenceAuthentified>
I have also severals XML files called "CurrentAuthentified1.xml", "CurrentAuthentifiedn.xml"
which contain also SingleElement. For example :
The CurrentAuthentified1.xml contains
<CurrentAuthentified1>
<SingleElement
SubsetName="NGPBASE"
.....
</SingleElement>
...
</CurrentAuthentified1>
...
The CurrentAuthentifiedn.xml contains
<CurrentAuthentifiedn>
<SingleElement
SubsetName="HMBASE"
.....
</SingleElement>
...
</CurrentAuthentifiedn>
With all this file, I must build an XML file called SubsetDescriptor.xml which contains all the
SubsetName present in the "ReferenceAuthentified.xml" :
<SubsetDescriptor>
<Subset subsetName="HMBASE"
...
impactedByEvolution="true"
</Subset>
.....
</SubsetDescriptor>
I must inform an attribute called impactedByEvolution with true or false.
<xsl:attribute name="impactedByEvolution">
<xsl:for-each select="$XslParameterFile//InputFile/@*
[starts-with(name(),'CurrentAuthentified')]">
<xsl:variable name="currentAuthentifiedFile"
select="document(.)"/>
<!-- check if the subset is found -->
<!-- in the currentAuthentified -->
<xsl:variable name="occurenceNumber">
<xsl:value-of select="count($currentAuthentifiedFile
//Subset[@subsetName=$subsetName])"/>
</xsl:variable>
<!-- interpret the result -->
<xsl:choose>
<xsl:when test="$occurenceNumber='0'">
</xsl:when>
<!-- subset found more than 0 -->
<xsl:otherwise>
<xsl:value-of select="'true'"/>
</xsl:otherwise>
</xsl:choose>
<!--</xsl:for-each>-->
</xsl:attribute>
My problem is as follows :
- If I find the subsetName in the first CurrentAuthentified how can I break the loop ?
- If I do not find the subsetName in all the CurrentAuthentified how to know that I did not find it
because I want to inform the impactedByEvolution attribute to "'false'" ?
If my problem is not enough clear, tell me, I will give you more information
Thanks for help
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list