Having an XML document
<A id="first">
<B id="second">
<C id="third">
<C id="fourth">
</B>
<B id="fifth">
<C id="sixth">
</B>
<B id="seventh">
...
</A>
how can I list possible combinations of id attributes while maintaining node hierarchy in the response?
first,second,third
first,second,fourth
first,fifth,sixth
...
Eventually I'd like to execute the query over PostgreSQL database hosted XML document through XML2 extension [1], such that individual lines could be unnested into table rows
SELECT unnest(string_to_array(xpath_list(<column>, '<query>', ','), ','))
FROM <table>
yielding a table similar to
| A | B | C |
|---|---|---|
| first | second | third |
| first | second | fourth |
| first | fifth | sixth |
Not sure it's even possible through XPath as I was not able to find any relevant documentation but would like to consult the approach with comunity before I abandon the idea
XPath 3.1:
gives a single string