Shalom Carmel
asked on
xquery - how to use a recurring value only once
I have a XML like this
<root>
<records>
<action id="1" site="A" item="abs"/>
<action id="2" site="A" item="hgt"/>
<action id="3" site="A" item="98uuj"/>
</records>
</root>
I want to make it into this one, where the site attribute will only appear once.
must use XQuery ...
<actions>
<site>A</site>
<items>
<item>
<id>1</id>
<code>abs</code>
</item>
<item>
<id>2</id>
<code>hgt</code>
</item>
<item>
<id>3</id>
<code>98uuj</code>
</item>
</items>
</actions>
<root>
<records>
<action id="1" site="A" item="abs"/>
<action id="2" site="A" item="hgt"/>
<action id="3" site="A" item="98uuj"/>
</records>
</root>
I want to make it into this one, where the site attribute will only appear once.
must use XQuery ...
<actions>
<site>A</site>
<items>
<item>
<id>1</id>
<code>abs</code>
</item>
<item>
<id>2</id>
<code>hgt</code>
</item>
<item>
<id>3</id>
<code>98uuj</code>
</item>
</items>
</actions>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
the distinct-value had me going :)
Open in new window