Re: [xsl] problem with handling conditional for loops

Subject: Re: [xsl] problem with handling conditional for loops
From: "Aron Bock" <aronbock@xxxxxxxxxxx>
Date: Wed, 27 Apr 2005 15:46:57 +0000
But since you need to apply different xpaths we can do something
similar...might be some scoping problems here (might have to move it
so the <xsl:variable wraps around) but something like this should work
 (although I'm suspicious of the text(), it would seem to me you need
. or something similar).

<xsl:choose>
<xsl:when test="document(Second.xml)/SubConcepts/SubConcept[1]/Value[$clsName=text()]">
<xsl:variable name="nodeToProcess"
select="document(Second.xml)/SubConcepts/SubConcept[1]/Value[$clsName=text()]"/>
</xsl:when>


<xsl:otherwise>
<xsl:variable name="Values"
select="document(Second.xml)/SubConcepts/SubConcept/Value/@name[.=$clsName]"/>
<xsl:variable name="nodeToProcess" select="$Values[1]">
</xsl:otherwise>
</xsl:when>
<<<

You probably want:

<xsl:variable name="nodeToProcess">
   <xsl:choose>
   ...
  </xsl:choose>
</xsl:variable>

The choose should be inside the variable definition; else the variable goes out of scope when the choose finishes.

Regards,

--A

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar  get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


Current Thread