Re: problem with handling conditional for loops
---------------------- > <xsl:for-each select="document(First.xml)/SubConcepts/SubConcept"> > <xsl:variable name="clsName" select="@name"/> > <xsl:for-each > select="document(Second.xml)/SubConcepts/SubConcept/Value"> > .......... > <xsl:choose> > <xsl:when > test="contains(normalize-space(lower-case($ontSecondVal)),normalize-space(low er-case($clsName)))"> > <xsl:call-template name="firstLevel"> > .......... > </xsl:call-template> > </xsl:when> > <xsl:otherwise> > ............... > </xsl:otherwise> > </xsl:choose> > </xsl:for-each> > </xsl:for-each> > --------------------- > > IN CASE I dont find $clsName in any of the Value/text() of > SubConcept, I'd like to loop though the remaining SubConcept nodes to > check whether $clsName exists in its @name. > > I hope this is slightly clearer. Else please let me know. Yes, it seems much clearer to me. I'll try to give you a quick response, but I don't have time at the moment to actually verify it. I have a feeling a refinement of your xpath is all that is needed but for some reason it's not coming today. I'm sure the others on the list can come up with one though if it exists. If what you're really looking for is the first Value element that has a valid $clsName (not sure what meets this criteria) you can get the group of all that meet the criteria and return the first of that set. <xsl:variable name="Values" select="document(Second.xml)/SubConcepts/SubConcept/Value/@name[some test to determine if clsName]"/> <xsl:variable name="clsName" select="$Values"> This of course hasn't been tested, but might be what you are looking for. It really has little to do with the parent loop. Jon Gorman
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format