[Home] [By Thread] [By Date] [Recent Entries]
Hi Wendell,
Thank you for you very quick answer, but.... In the example, my input xml would look like (something): <?xml version="1.0"?> <node a="hello"> <node a="Hi"> <node a="Godday"></node> <node a="Godday"></node> <node a="Godday"></node> </node> </node> Here, in the example I had, I would like the colours to be Red, Green, Bluez respectively for Hello, Hi and Godday (Bluez should of course be Blue..) I forgot that there exists a node() with a distinct meaning. In my real xml, the name is 'Menu', and you should interchange all where I wrote 'node' to 'Menu'. The problem still persists. I have tried, successfully: <xsl:comment><xsl:value-of select="count(ancestor-or-self::Menu)"/></xsl:comment> (or node) which gives a comment telling me where it is. When I do the same inside the predicate, then it goes wrong. I have a working solution: <xsl:variable name="n"><xsl:value-of select="count(ancestor-or-self::Menu)"/></xsl:variable> <xsl:variable name="c"> <xsl:choose> <xsl:when test="$n=1"><xsl:value-of select="$Colours[1]"/></xsl:when> <xsl:when test="$n=2"><xsl:value-of select="$Colours[2]"/></xsl:when> <xsl:when test="$n=3"><xsl:value-of select="$Colours[3]"/></xsl:when> <xsl:when test="$n=4"><xsl:value-of select="$Colours[4]"/></xsl:when> <xsl:when test="$n=5"><xsl:value-of select="$Colours[5]"/></xsl:when> <xsl:when test="$n=6"><xsl:value-of select="$Colours[6]"/></xsl:when> <xsl:otherwise><xsl:value-of select="$Colours[7]"/></xsl:otherwise> </xsl:choose> </xsl:variable> Which I have implemented at the moment, but I would still very much like to know what is wrong with the other one... If you say that it should work, given the names of the elements being correct, then... Or have I misunderstood your reply? Regards, Ragulf Pickaxe :-) From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> _________________________________________________________________ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail
|

Cart



