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

Re: Merging Document Problem

Subject: Re: Merging Document Problem
From: Mike Trotman <mike.trotman@xxxxxxxxxxxxx>
Date: Sun, 04 Jul 2004 19:28:45 +0100
michael trotman
Hi John.

Sorry - I didn't see your earlier message that included the namespace declaration.
Yes - you do get namespaces unless you exclude them.


I haven't done much with mixed documents which include different namespaces - but maybe if you declare the same namespace in your template and add it to the exclude-result-prefixes option it will get excluded.
I'm not sure of the technical details of what triggers / suppresses namespace propagation so can't be more help on that.



John Hamman wrote:


Thanks Mike, its working great. Only thing I got to figure out is that  a
namespace is being thrown in.

<instrument type="BreadCrumb" id="PageBreadCrumb"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Breadcrumb>
<Topic title="Home" link="/">
<Topic title="Services" link="/services">
<Topic title="Content Management" link="/services/content-management" /> </Topic>
</Topic>
</Breadcrumb>
</instrument>


-----Original Message-----
From: Mike Trotman [mailto:mike.trotman@xxxxxxxxxxxxx] Sent: Sunday, July 04, 2004 1:58 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: Merging Document Problem


Using XSLT - the <xsl:copy/> and <xsl:copy-of/> elements should give you what you need.

So - using XSLT;
Assuming you are processing DocumentB.xml as current document - the following will construct you're combined <theater> element.


<xsl:template match='theater'>
<xsl:copy>
<xsl:copy-of select='@*'/> <!-- this copies any attributes on <theater> - although you currently have none -->
<xsl:copy-of select='instrument'/>
<instruments>
<xsl:copy-of select='document("Breadcrumb.xml")/ensemble/theater/instrument'/>
</instruments>
</xsl:copy>
</xsl:template>


John Hamman wrote:



Thanks Michael,
I don't see anything that begin with XML or at least it shouldn't. And I just want to copy/merge the document that is below (breadcrumb.xml)
To another xml document so that it's a DIRECT copy. Meaning I want it to


end


up looking the same.
So for example.
If Breadcrumb.xml looks like this
<ensemble>
	<theater>
		<instrument type="BreadCrumb" id="PageBreadCrumb">
			<!-- This App is the bread crumb of the page. -->
			<Breadcrumb>
				<Topic title="Home" link="/">
					<Topic title="Services"
link="/services">
						<Topic title="Content
Management" link="/services/content-management"/>
					</Topic>
				</Topic>
			</Breadcrumb>
		</instrument>
	</theater>
</ensemble>

And DocumentB.xml looks like this
<ensemble>
	<theater>
		<performance link="/Some/Link" topic="/services"
lang="en-US" title="My Music" ver="1.0" lastmod="6/30/2004T12:00:00:00">
			<!-- Page Info  -->
			<FriendlyName>Friendlyname here</FriendlyName>
			<Activate date="2000-01-15T12:00:00"/>
			<Expires date="2005-01-15T12:00:00"/>
			<Creator>John Hamman</Creator>
			<MetaData name="copyright" value="Copyright 2004"/>
			<Description><![CDATA[Blah Blah
Blah]]></Description>
			<Keywords>Blah Blah Blah</Keywords>
			<Custom name="CssName"><![CDATA[IA]]></Custom>
		</performance>
	</theater>
</ensemble>

Then the OUTPUT will be a Merged XML file that looks like this.
<ensemble>
	<theater>
		<performance link="/Some/Link" topic="/services"
lang="en-US" title="My Music" ver="1.0" lastmod="6/30/2004T12:00:00:00">
			<!-- Page Info  -->
			<FriendlyName>Friendlyname here</FriendlyName>
			<Activate date="2000-01-15T12:00:00"/>
			<Expires date="2005-01-15T12:00:00"/>
			<Creator>John Hamman</Creator>
			<MetaData name="copyright" value="Copyright 2004"/>
			<Description><![CDATA[Blah Blah
Blah]]></Description>
			<Keywords>Blah Blah Blah</Keywords>
			<Custom name="CssName"><![CDATA[IA]]></Custom>
		</performance>
<instruments>
			<instrument type="BreadCrumb" id="PageBreadCrumb">
			<!-- This App is the bread crumb of the page. -->
			<Breadcrumb>
				<Topic title="Home" link="/">
					<Topic title="Services"
link="/services">
						<Topic title="Content
Management" link="/services/content-management"/>
					</Topic>
				</Topic>
			</Breadcrumb>
		</instrument>
		</instruments>
	</theater>
</ensemble>






-----Original Message-----
From: Michael Kay [mailto:mhk@xxxxxxxxx] Sent: Sunday, July 04, 2004 1:17 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: Merging Document Problem


Without knowing what the other document looks like, or what you want the
result to look like, it's very hard to advise you.

2 observations on your XML:

(a) Names beginning "xml" (in any case combination), like XmlSite, should
not be used because they are reserved for future standardisation

(b) The value of xsi:noNamespaceSchemaLocation is supposed to be a URI. The
value "H:\Web
Clients\WWWRoot\Ithinkdesigns\XmlSite\_data\Performance.xsd" is not a URI,
it is a Windows filename. This essentially locks you into Microsoft
products, which don't enforce the standard in this area.

Michael Kay





-----Original Message-----
From: John Hamman [mailto:John@xxxxxxxxxxxxxxxxx] Sent: 04 July 2004 01:32
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Merging Document Problem


Hi all, Maybe someone can help with this.

I have 2 docs I want to merge and one of them is this:



Breadcrumb.xml

<ensemble xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="H:\Web
Clients\WWWRoot\Ithinkdesigns\XmlSite\_data\Performance.xsd">

<theater>

<instrument type="BreadCrumb" id="PageBreadCrumb">

<!-- This App is the bread crumb of the
page. -->


<Breadcrumb>

                                              <Topic title="Home"
link="/">

                                                          <Topic
title="Services" link="/services">


<Topic title="Content Management" link="/services/content-management"/>


</Topic>

</Topic>

</Breadcrumb>

</instrument>

</theater>

</ensemble>



And I want to make sure that everything from <theater> on is copied exactly
like this one.


Does anyone know how I can do this. I am totally lost since its recursive

john



--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
--+--






--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
--+--



--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
--+--








-- Datalucid Limited 8 Eileen Road South Norwood London SE25 5EJ United Kingdom

/
tel :0208-239-6810
mob: 0794-725-9760
email: mike.trotman@xxxxxxxxxxxxx

UK Co. Reg:   4383635
VAT Reg.:   798 7531 60

/


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.