Ravindar, .Net, Biztalk developer

Just another WordPress.com weblog

Get Uniques values from a list through XSLT

Get Unique values for a list of values

xxxx

yyyy

xxxx

The desired output is:

xxxx
yyyy

so use this

<xsl:variable name="unique-list"
select="//state[not(.=following::state)]" />

for example like below 

<xsl:variable name="unique-list"
select="s4:AdTermID[not(.=following::s4:AdTermID)]" />

the above statement will get the unique values in to that variable (just like it is an array)

if you want to make a for each loop based on this unique values use below code

<xsl:for-each select="$unique-list">

your logic here

</xsl:for-each>

if you want to compare any value to this array element use below code where AdTermID is the elemnt

<xsl:if test="your elment here=s4:AdTermID[not(.=following::s4:AdTermID/text())]">

when you try to compare a value with thes values in the array you should use /text()

source of article

http://www.bernzilla.com/item.php?id=333

see the comments of Abhinav Maheshwari

June 16, 2011 Posted by | Biztalk Server | Leave a Comment

   

Follow

Get every new post delivered to your Inbox.