xsl-list
[Top] [All Lists]

AW: Problem with assigning value to variable

2006-03-02 01:48:25
Ok, I solved the problem. Quick and dirty. But anyway, here it is:

<xsl:if test="contains(string($bauteil_test),'true')">

I just test, if the variable-Value contains the String "true". So it doesn't
matter, if the value is "truetrue" or "truetruetrue" or anything else.


Greets,

Barthi

-----Ursprüngliche Nachricht-----
Von: Christian Barth [mailto:christian(_at_)buerobarth(_dot_)de]
Gesendet: Mittwoch, 1. März 2006 14:15
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: [xsl] Problem with assigning value to variable

Hi List!

<xsl:for-each
select="/tamino-
result/Bs_Bauteil_Liste[(_at_)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[(_at_)ID=$gebId]/Stockwerk_Liste/Stockwerk[(_at_)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






--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>