Forum Moderators: open

Message Too Old, No Replies

XSL:using parameters in IF TEST statement

         

zzqproject

12:11 am on Nov 22, 2005 (gmt 0)



hi, i want to evaluate the value of a parameter in an IF element, the code goes following which does not work:

+++++++++++++++++++++++++++++++++
<xsl:param name="msgid" />
<xsl:for-each select="//message">
<xsl:if test="@id=$msgid">

......... processing.......

++++++++++++++++++++++++++++++++

where id is an attribute of all message element in the xml. basically i would like the code to perform certain processing when the message id = the given msgid. hav tried test="@id=[$msgid]", test="[id=$msgid]" all do not work. what should i write here?

thanks alot!

choster

5:34 pm on Nov 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can you post a snippet of your XML, or tell us where in the document tree you are when calling this? If there are no descendent <message>s, you won't see any results, and that is the first place I would check; your posted syntax is correct. In my experience square brackets are only used for XPath predicates, so your other examples would be nonsensical.