I need to select nodes with distinct name attribute values considering the first character only.
The XML is
<A>
<B name="X_01"/>
<B name="X_02"/>
<B name="Y_01"/>
<B name="X_03"/>
<B name="Z_01"/>
<B name="Y_02"/>
</A>
Desired output
<B name="X_01"/>
<B name="Y_01"/>
<B name="Z_01"/>
It doesn't have to be the first occurrence of B with the distinct first character value in the name attribute.
I am new to XQuery and wasn't able to build a working statement.
Thanks for your help