xsl-list
[Top] [All Lists]

Re: problem with handling conditional for loops

2005-04-27 08:15:22
Jon Gorman wrote:

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[1]">
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.

Theres only one problem though in this solution. For instance the $clsName returns values 'Hello', 'How', 'Are', 'You' each time the for-loop executes, extracting a node value from First.xml one at a time. My XPaths differ in how I look for the existence of 'Hello' etc. in SubConcept[1] and the rest of the SubConcept's.

(1) First I use the XPath - document(Second.xml)/SubConcepts/SubConcept[1]/Value and match if text() = $clsName

(2) If 'Hello' etc. isnt available in (1) then I look for it using the XPath - document(Second.xml)/SubConcepts/SubConcept/@name and match if @name=$clsName

Since the XPaths are different I cant really get all the matches together in one shot such as in your reply. Moreover Second.xml is a very large file and I would prefer to save execution time by avoiding duplicate match finds. However if there aint any other way out I will use it !

Comments Jon or anybody else?
Rahil

Jon Gorman

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--