if suppose my database having three row records by fetching that data i am converting into xml data as shown below :
Here is my XML:
<NewDataSet>
<Table>
<RECORD_TYPE_CODE>CTD</RECORD_TYPE_CODE>
<MSG_TYPE_CODE>O103N</MSG_TYPE_CODE>
<CTD_SEQ_NUM>000086</CTD_SEQ_NUM>
<CTD_CTD_PKG_ID>2</CTD_CTD_PKG_ID>
</Table>
<Table>
<RECORD_TYPE_CODE>CTO</RECORD_TYPE_CODE>
<MSG_TYPE_CODE>O203N</MSG_TYPE_CODE>
<CTD_SEQ_NUM>000087</CTD_SEQ_NUM>
<CTD_CTD_PKG_ID>2</CTD_CTD_PKG_ID>
</Table>
<Table>
<RECORD_TYPE_CODE>CTH</RECORD_TYPE_CODE>
<MSG_TYPE_CODE>O303N</MSG_TYPE_CODE>
<CTD_SEQ_NUM>000088</CTD_SEQ_NUM>
<CTD_CTD_PKG_ID>2</CTD_CTD_PKG_ID>
</Table>
</NewDataSet>
through c sharp code behind using for loop i m sending package id (CTD_CTD_PKG_ID)and Sequencenum(CTD_SEQ_NUM) through xslt argument parameters it was passing properly in a sequential order like 000086,000087,000088 but first time for in aloop i will pass 000086 seqnum it was fetching proper manner next when i m passing 000087 it was generating data in table of 000086 only why it was happening passing parameter value is goin good in a sequential order
here is my XSLT:
<xsl:param name="PackageId" />
<xsl:param name="SequenceNum" />
<xsl:template match="/">
<xsl:apply-templates mode="SequenceB" select="(NewDataSet/Table[CTD_CTD_PKG_ID =$PackageId] | NewDataSet/Table[CTD_SEQ_NUM =$SequenceNum])[1]"/>
</xsl:template>
I guess (if my guess is incorrect, you need to explain better the problem) that the value of your
$PackageIdparameter is always defined as2.The XPath expression you are using:
selects the first node from the union of the nodes selected by:
and:
Do note, that if the value of the
$PackageIdparameter is2, then the first node of theis union is always/*/Table[1].The solution is to replace the XPath expression you are using with: