xsl-list
[Top] [All Lists]

mixing two XMLs

2002-11-08 04:37:46
I have two XML and I want to mix them depending on a element value , like two tables with a relation in a relational database

My XMLs are:

<books>
        <book>
                <id_book>2</idbook>
                <tittle>title1</tittle>
                <Edition>2000</Edition>
                <chapters>
                        <number>12</number>
                </chapters>
        </book>
        <book>
                <id_book>7</idbook>
                <tittle>title2</tittle>
                <Edition>2001</Edition>
                <chapters>
                        <number>19</number>
                </chapters>
        </book>
        <book>
                <id_book>9</idbook>
                <tittle>title3</tittle>
                <Edition>2001</Edition>
                <chapters>
                        <number>9</number>
                </chapters>
        </book>
</books>

<pages>
        <page>
                <id_book>2</id_book>
                <n_page>765</n_page>
                <topic_data>
                        <ocurrences>34</ocurrences>
                        <value>tree</value>
                </topic_data>
        </page>
        <page>
                <id_book>9</id_book>
                <n_page>1023</n_page>
                <topic_data>
                        <ocurrences>21</ocurrences>
                        <value>bird</value>
                </topic_data>
        </page>
<pages>

And I want to generate next xml.The element used as 'key' is id_book:

<books>
        <book>
                <id_book>2</idbook>
                <tittle>title1</tittle>
                <Edition>2000</Edition>
                <chapters>
                        <number>12</number>
                </chapters>
                <page>
                        <n_page>765</n_page>
                        <topic_data>
                                <ocurrences>34</ocurrences>
                                <value>tree</value>
                        </topic_data>
                </page>
        </book>
        <book>
                <id_book>7</idbook>
                <tittle>title2</tittle>
                <Edition>2001</Edition>
                <chapters>
                        <number>19</number>
                </chapters>
        </book>
        <book>
                <id_book>9</idbook>
                <tittle>title3</tittle>
                <Edition>2001</Edition>
                <chapters>
                        <number>24</number>
                </chapters>
                <page>
                        <n_page>1023</n_page>
                        <topic_data>
                                <ocurrences>21</ocurrences>
                                <value>bird</value>
                        </topic_data>
                </page>
        </book>
</books>

How could I do this?

Thanks in advance

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail


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



<Prev in Thread] Current Thread [Next in Thread>