Hi
I have an XML structure that I need to query using XQuery. As far as I have been able to find, this may not even be possible, but since I am so new to XQuery I thought I may ask.
I need to query the XML below and return something that looks like:
<product>
<title>Acer Liquid</title>
<image>ACER-LIQUID.jpg</image>
<networks>
<network>O2O</network>
<network>VOD</network>
</networks>
<colours>
<colour>Blue</colour>
<colour>Black</colour>
</colours>
</product>
So my query is essentially something like: Get all product details where there is a salespackage that belongs to "Pay Monthly" that points to it (via main_product), and attach the network property from each sales package that points to it. But group the results by the product.product_model field.
Source XML:
<root>
<package>
<title>package1</title>
<categories><category group="Other" name="Pay Monthly"/></categories>
<properties>
<value key="main_product">PRODUCT#14649766#PART#ACERLIQUIDBLACK</value>
<value key="network_code">O2O</value>
</properties>
</package>
<package>
<title>package2</title>
<categories><category group="Other" name="Pay Monthly"/></categories>
<properties>
<value key="main_product">PRODUCT#14649700#PART#ACERLIQUIDBLUE</value>
<value key="network_code">VOD</value>
</properties>
</package>
<product>
<title>Acer Liquid</title>
<properties>
<value key="product_code">PRODUCT#14649700#PART#ACERLIQUIDBLUE</value>
<value key="product_model">Acer Liquid|ACER_LIQUID</value>
<value key="product_image_url">ACER-LIQUID.jpg</value>
<value key="colour">Blue</value>
</properties>
</product>
<product>
<title>Acer Liquid</title>
<properties>
<value key="product_code">PRODUCT#14649766#PART#ACERLIQUIDBLACK</value>
<value key="product_model">Acer Liquid|ACER_LIQUID</value>
<value key="product_image_url">ACER-LIQUID.jpg</value>
<value key="colour">Black</value>
</properties>
</product>
</root>