[
Lists Home |
Date Index |
Thread Index
]
At 2004-03-23 08:38 -0600, Bill Riegel wrote:
>What to look thru a listOfNodes, and set contents on a variable, foundIt,
>when I found what I am looking for, then break.
XSLT does not work this way ... the semantics for an <xsl:for-each> are
different than a programmer's "for loop".
><xsl:variable name="foundIt">
> <xsl:for-each select="$listofNodes">
> <xsl:if test="string(current()) = $mySearchItem">
> <!-- break out of look if found what I am looking
>for -->
> <xsl:break>
> </xsl:if>
> </xsl:for-each>
></xsl:variable>
>
><!-- do something with foundIt -->
XSLT does not work this way either ... variables are bound with a value and
cannot change within their scope.
You haven't described what you want to do to your information, you have
only described a non-functional programmer's approach to a coding pattern.
Perhaps you need something like:
<xsl:for-each select="$listofNodes[.=$mySearchItem]">
<!--do something with found nodes equal to my search item-->
</xsl:for-each>
When using XSLT you merely address the nodes that you want to process
rather than attempting a circuitous design pattern based on traditional
programming techniques.
I hope this helps.
............................ Ken
--
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/x/bc
|