This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to transform flat structure into hierarchical one?




I get a flat structure as a result of SQL query and want to transform it
into hierarchical structure.

E.g. initial XML could look like:

<record_set>
    <record>
        <house_id>h1</house_id>
        <room_id>r1</room_id>
    </record>
    <record>
        <house_id>h1</house_id>
        <room_id>r2</room_id>
    </record>
    <record>
        <house_id>h2</house_id>
        <room_id>r3</room_id>
    </record>
</record_set>

and the result of transformation could look like:

<house_list>
    <house>
        <id>h1</id>
        <rooms>
            <room>
                <id>r1</id>
            </room>
            <room>
                <id>r2</id>
            </room>
        </rooms>
    </house>
    <house>
        <id>h2</id>
        <rooms>
            <room>
                <id>r3</id>
            </room>
        </rooms>
    </house>
</house_list>

Thanks.
Alex



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]