Click to See Complete Forum and Search --> : GB stands for Great Britain ?


herodote92
09-20-2005, 02:53 PM
Hi happy XMLers !

I'm starting with XML. Here is what I have in my stylesheet and which works:

<xsl:template match = "record">
<p>RECORD <xsl:value-of select="position()"/><br />
Country: <xsl:value-of select = "/my_doc/my_table/elts/elt[child::code='F']/valeur" />
<br />
Capital: <b><xsl:value-of select = "Capital" /></b>
</p>
</xsl:template>


Now what I wish is yo use, not a constant like 'F', but the value of a child of my current node. To be less confused, if I use the above, I will always get "France". What I want is that, if the code is 'F', I get 'France', if it is 'GB', I get 'Great Britain', and so on.

All these values are stored in my xml page (couple code / valeur). What I can't get is using a text node value instead of a constant.

Is this possible ? How is it possible ? Why is it not possible ?

So many thanks in advance.

herodote92
09-20-2005, 04:23 PM
Gooooooot iiiiiiiiiiiiiiit !!!!!


elt[code=current()]


I searched for no more than 3 hours. This has been a good day.

zizo80
09-21-2005, 10:27 AM
I am sorry but i didnīt get the point?

herodote92
09-21-2005, 12:14 PM
The problem was that, if you use a normal XPath expression, like "./code", it won't work in this case, because (as I understood) there are kind of 2 different "current nodes" at the same time. Well, I probably don't explain it right, but anyway, it didn't work with XPath, while it worked with current(), which is not XPath, but XSLT or something like that.

I was fumbling in the XPath doc while I should have looked somewhere else, that's why I lost 3 hours on it.