[xsl] Problem with assigning value to variable

Subject: [xsl] Problem with assigning value to variable
From: "Christian Barth" <christian@xxxxxxxxxxxxx>
Date: Wed, 1 Mar 2006 14:15:06 +0100
Hi List!

<xsl:for-each
select="/tamino-result/Bs_Bauteil_Liste[@gebaeude_id=$gebId]/Brandwand_Liste
/Brandwand[funktion='Trennwand']">
 <xsl:sort select="." order="ascending" data-type="text"/>
 <xsl:variable name="ID" select="@ID" />
 <xsl:variable name="bez" select="bezeichnung" />
 <xsl:variable name="wand_ID" select="Wand_id_Liste/wand_id"/>
 <xsl:variable name="bauteil_test" >		<!-- Pr|ft, ob das Bauteil
im aktuellen Stockwerk Teil der Trennwand ist. Nur dann wird diese in den
Baum eingef|gt. -->
   <xsl:for-each
select="/tamino-result/Gebaeude[@ID=$gebId]/Stockwerk_Liste/Stockwerk[@ID=$s
tock_ID]//bauteil_id">
     <xsl:if test="string(.) = string($wand_ID)">
       <xsl:text>true</xsl:text>
     </xsl:if>
   </xsl:for-each>
 </xsl:variable>
 <xsl:if test="$bauteil_test = 'true'">
	DO SOMETHING
 </xsl:if>
</xsl:for-each>

The Element Trennwand consists of several wand-Elements with a wand_id.
These wand-Elements are children of bauteil-Elements with a bauteil_id.
So wand_id and bauteil_id are the same.
With the above code I  want to test, if a Trennwand has a wand_id same as
the bauteil_id in a specific Stockwerk. So I can find out, in which
Stockwerk the Trennwand is located.
The problem is, that these bauteil_ids exist several times in every
stockwerk.
Now, the code it self is working, but I have a problem with the variable
bauteil_test.
In my example the bauteil_id exists three times in the Stockwerk. So the
result of the variable is:

<xsl:variable name="bauteil_test" >truetruetrue</xsl:variable>

But what I want is:

<xsl:variable name="bauteil_test" >true</xsl:variable>


How can I do this??

I hope someone understood my problem.

Thanks,
Barthi

Current Thread