transform problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sparko

    #1

    transform problem

    OK here's one that's puzzlin me!


    xml source
    ----------

    <x yid="1" >
    <x yid="2" >
    <x yid="n" >

    <z yid="1" zid="1" ca1="" ca2="aValue1" ca3=""/>
    <z yid="1" zid="2" ca1="aString1" ca2="" ca3=""/>
    <z yid="1" zid="3" ca1="" ca2="" ca3="aValue2"/>
    <z yid="1" zid="4" ca1="" ca2="aString2" ca3=""/>
    <z yid="1" zid="5" ca1="" ca2="" ca3="aString3"/>
    <z yid="2" zid="1" ca1="" ca2="aValue3" ca3=""/>
    <z yid="2" zid="2" ca1="aString4" ca2="" ca3=""/>
    <z yid="2" zid="3" ca1="" ca2="" ca3="aValue4"/>
    <z yid="2" zid="4" ca1="" ca2="aString5" ca3=""/>
    <z yid="2" zid="5" ca1="" ca2="" ca3="aString6"/>


    xml output required
    -------------------
    <x yid="1" ca1="aValue1" ca2="aString1" ca3="aValue2" ca4="aString2"
    ca5="aString3"/>
    <x yid="2" ca1="aValue1" ca2="aString4" ca3="aValue3" ca2="aString5"
    ca2="aString6"/>
    ...n


    Description
    -----------
    The input xml must be resolved such that attributes are added to the x
    nodes corresponding to the z nodes row with the relationship being yid
    and the set of z nodes always containing five nodes identified by zid.
    For each of the five z nodes that is processed (per yid) a set
    algorithm is applied that extracts the value from the correct ca
    attribute and uses it as the value of the attribute
    that is being inserted into the x node.

    Any thoughts!
Working...