I am having an issue with the following, I need the ID to be of each promotiom:
Here is my XML:
&
The correct XPath in this situation is:
<asp:LinkButton ID ="{../ID}" onclick="LinkClicked">
Since you are in <Title>
context within the <xsl:for-each>
, you must go up one level and fetch the <ID>
from there. Your try
/Promotions/Promotion[Category=$category]/ID
fetches all <Promotion>
s of a certain category and takes the first ID from the bunch, which is the same every time, naturally.
Just change
<asp:LinkButton ID ="{/Promotions/Promotion[Category=$category]/ID}" onclick="LinkClicked">
to
<asp:LinkButton ID ="{../ID}" onclick="LinkClicked">
Try something like position()=1
in your XSLT to select the first occurrence.