[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Creating child elements to existing Parent elements

Subject: Creating child elements to existing Parent elements
From: "Cherry Yang" <qian.cherry.yang@xxxxxxxxx>
Date: Thu, 7 Sep 2006 11:40:45 -0400
document create child element
Hi all,
I was not able to find out how to create child elements to existing
Parent elements after going through my XSLT document and searching on
the web. I might not be searching with the right key words. Here is my
problem:

My Source xml document looks something like this:
<Spices>
     <Spice name="black pepper" id="11"/>
     <Spice name="ginger powder" id="12"/>
      <Spice name="salt" id="13"/>
</Spices>
....
<MeatsParentTags>
......
    <Meats>
         <Meat name="pork" id="21"/>
    </Meats>
</MeatParentTags>
.....
<Vegetables>
        <Vegetable name="Green Pepper" id="34/>
</Vegetables>

My desired output would be a combination of these tags.
<Ingredients>
       <Ingredient name="black pepper" id="11"/>
       <Ingredient name="ginger powder" id="12"/>
      <Ingredient name="salt" id="13"/>
       <Ingredient  name="pork" id="21"/>
        <Ingredient name="Green Pepper" id="34/>
</Ingredients>

My XSLT would create element <Ingredients> when processing <Spices>.
Later on it should only create <ingredient> element as child element
to <Ingredients> element when processing <Meat> or <Vegetable>. Any
suggestion on how this can be achieved?

I appreciate your help!

QCY

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.