Explanation of converting exporting an XML document as a relational database using XSLT

Posted by Yaaqov on Stack Overflow See other posts from Stack Overflow or by Yaaqov
Published on 2010-04-13T16:59:31Z Indexed on 2010/04/13 17:03 UTC
Read the original article Hit count: 372

Filed under:
|
|
|

I would like to better understand the basic steps needed to a take an XML document like this Breakfast Menu...

<?xml version="1.0" encoding="ISO-8859-1"?>
<breakfast_menu>
    <food>
        <name>Belgian Waffles</name>
        <price>$5.95</price>
        <description>two of our famous Belgian Waffles with plenty of real maple syrup</description>
        <calories>650</calories>
    </food>
    <food>
        <name>Strawberry Belgian Waffles</name>
        <price>$7.95</price>
        <description>light Belgian waffles covered with strawberries and whipped cream</description>
        <calories>900</calories>
    </food>
    <food>
        <name>Berry-Berry Belgian Waffles</name>
        <price>$8.95</price>
        <description>light Belgian waffles covered with an assortment of fresh berries and whipped cream</description>
        <calories>900</calories>
    </food>
    <food>
        <name>French Toast</name>
        <price>$4.50</price>
        <description>thick slices made from our homemade sourdough bread</description>
        <calories>600</calories>
    </food>
    <food>
        <name>Homestyle Breakfast</name>
        <price>$6.95</price>
        <description>two eggs, bacon or sausage, toast, and our ever-popular hash browns</description>
        <calories>950</calories>
    </food>
</breakfast_menu>

And "export" it to say, an Access or MySQL database using XSLT, creating two joined tables:

  • Table: breakfast_menu
    • Field: menu_item_id
    • Field: food_id
  • Table: food
    • Field: food_id
    • Field: name
    • Field: price
    • Field: description
    • Field: calories

If there are online tutorials on this that you know of, I'd be interesting in learning more, as well.

Thanks.

© Stack Overflow or respective owner

Related posts about xslt

Related posts about sql