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

Re: Generating XML fragment to DOM node using XSL

Subject: Re: Generating XML fragment to DOM node using XSL
From: Steve Dussinger <sdussing@xxxxxxxxx>
Date: Tue, 16 Dec 2003 13:10:22 -0800
xml fragment in xsl
On 12/16/03 12:49 PM, "cknell@xxxxxxxxxx" <cknell@xxxxxxxxxx> wrote:

> Here are two XML documents and an XSLT stylesheet
> 
> sduss_a.xml
> -------------
> <?xml version="1.0" encoding="UTF-8" ?>
> <menu>
> <breakfast />
> <lunch />
> </menu>
> 
> 
> sduss_b.xml
> -------------
> <?xml version="1.0" encoding="UTF-8" ?>
> <dinner>
> <salad />
> <soup />
> <main-dish />
> <dessert />
> </dinner>
> 
> sduss.xsl
> -------------
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" indent="yes" encoding="UTF-8" />
> <xsl:variable name="dinner" select="document('sduss_b.xml')" />
> 
> <xsl:template match="/menu">
>   <menu>
>     <xsl:copy-of select="*" />
>     <xsl:copy-of select="$dinner/*" />
>   </menu>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> Now apply suss.xsl to sduss_a.xml and you will get:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <menu>
> <breakfast />
> <lunch />
> <dinner>
> <salad />
> <soup />
> <main-dish />
> <dessert />
> </dinner>
> </menu>
> 
> There it is, processed with XALAN-J. I'm still new to Java, so I won't be able
> to help you debug your program, but the problem is clearly not XSL and you may
> do better posting to the XALAN-J list to get pointers programming those
> classes.

Unfortunately, this isn't doing what I need to do. This XSL creates a
completely new DOM document with a 'menu' root. I need to put a series of
nodes into an existing document at a specific node beneath the root.

I want the root node to be any currently existing element in my DOM tree. I
can control the choice of which node is my parent in the destination tree,
but if I try to put more than one node under that parent element, I get this
error, even though I don't think the error is correct.

I understand that I can't create a DOM document with more than one root
element, but that's not what I'm trying. I already have the DOM document,
and I want to put a series of nodes under a child element of that DOM
document...

Thanx,
   Steve



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


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.