Jump to content

XML distinct values with xslt/xquery 1.0


Recommended Posts

Hi, Can you pls help how to retrive only the distinct values from an xml file using xslt/xquery 1.0?<Main> <element1>table</element1> <element2>chair</element2> <element3 newattr1="samsung">cooler1</element3> <element4 new attr1="whirlpool">cooler2</element4> <element1>table</element1> <element2>chair</element2> <element3 newattr1="samsung">cooler1</element3> <element4 new attr1="whirlpool">cooler2</element4> <element3 newattr1="samsung">cooler1</element3> <element2>chair</element2> <element1>table</element1></Main>to get string value as:table | chair |cooler1=samsung |cooler2=whirlpool |

Link to post
Share on other sites

Using a loop, store values in an array and keep checking the array upon each iteration to see if the value already exists.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...