Hi! I'm sorry, but my last mail didn't reach the mailing list. Here it comes again. The problem is already solved. You can see the solution below
Thanks, Barthi ---------------------------------------------------------------------------- ---- Ooohh Yes, you are brilliant! That was exactly what I was looking for. Thanks, Barthi > -----Original Message----- > From: Robert Milic [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 18, 2006 8:10 PM > To: [EMAIL PROTECTED] > Subject: Re: How to asign a value to a variable?? > > Hey, > > no this isn't possible. Variables in XSL have to be assigned a value > when they are declared and cannot be modified later on. What you could > do is the following (I haven't tested it so it might have errors): > > <xsl:template match="/"> <!-- I guess... --> <xsl:for-each select="*"> > <xsl:choose> > <xsl:when test="local-name()='rettungswege'"> > <xsl:call-template name="dosomething"> > <xsl:with-param name="mynodes" select="rw"/> > </xsl:call-template> > </xsl:when> > <xsl:when test="local-name()='trennwaende'"> > <xsl:call-template name="dosomething"> > <xsl:with-param name="mynodes" > select="trennwand"/> > </xsl:call-template> > </xsl:when> > </xsl:choose> > </xsl:for-each> > </xsl:template> > > <xsl:template name="dosomething"> > <xsl:param name="mynodes"> > <xsl:for-each select="$mynodes"> > do something > </xsl:for-each> > </xsl:template> > > Regards, > > Robert > > > Christian Barth wrote: > > Hi! > > > > I want to define a global variable with no value. > > > > Then I want to asign a value to the variable in a > choose-when-select. > > > > I think of something like this (but this one doesn't work): > > > > > > <xsl:variable name="element" /> > > > > <xsl:for-each select="*"> > > > > <xsl:choose> > > > > <xsl:when test="local-name() = 'rettungswege'"> > > > > <xsl:variable name="element" > select="rettungswege/rw" > > /> > > > > </xsl:when> > > > > <xsl:when test="local-name() = 'trennwaende'"> > > > > <xsl:variable name="element" > > select="trennwaende/trennwand" /> > > > > </xsl:when> > > > > </xsl:choose> > > > > </xsl:for-each> > > > > <xsl:for-each select="$element"> > > > > ...do something... > > > > </xsl:for-each> > > > > > > > > Is this possible? > > > > > > > > Thanks, > > > > Barthi > > > > ________________________________ From: Pelssers, Robby, VF-NL [mailto:[EMAIL PROTECTED] Sent: Thursday, January 19, 2006 8:15 AM To: [email protected] Subject: RE: How to asign a value to a variable?? This code looks way of track... You are trying to create a elementlist by declaring the variable element once and in the choose-construction you assign values. Next you try to loop over a none existing elementlist.... Better explain what kind of starting situation you have and what you are trying to accomplish. Cheers, Robby Pelssers -----Original Message----- From: Christian Barth [mailto:[EMAIL PROTECTED] Sent: woensdag 18 januari 2006 19:21 To: [email protected] Subject: How to asign a value to a variable?? Hi! I want to define a global variable with no value. Then I want to asign a value to the variable in a choose-when-select. I think of something like this (but this one doesn't work): <xsl:variable name="element" /> <xsl:for-each select="*"> <xsl:choose> <xsl:when test="local-name() = 'rettungswege'"> <xsl:variable name="element" select="rettungswege/rw" /> </xsl:when> <xsl:when test="local-name() = 'trennwaende'"> <xsl:variable name="element" select="trennwaende/trennwand" /> </xsl:when> </xsl:choose> </xsl:for-each> <xsl:for-each select="$element"> ...do something... </xsl:for-each> Is this possible? Thanks, Barthi --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
