RE: [xsl] Merge Question Take 2 (complex)

Subject: RE: [xsl] Merge Question Take 2 (complex)
From: "John Hamman" <John@xxxxxxxxxxxxxxxxx>
Date: Wed, 7 Apr 2004 23:46:20 -0400
Oh, sorry for the misunderstanding. It looks like this. And its way off what
I need.

<iThink.ePulp><Meta>
					<Title> blah blah Web Design</Title>
					<FriendlyName> blah blah Home Page:
en-EN</FriendlyName>
					<Activate date="2000-01-15T12:00:00"
/>
					<Expires date="2005-01-15T12:00:00"
/>
					<Creator> blah blah </Creator>
					<MetaData name="copyright" value="
blah blah " />
					<Description>This is a description
of this page</Description>
					<Keywords />
				</Meta><PageBody>
            &lt;br /&gt;
            &lt;center&gt;
               &lt;div id="TextOnlyLink"&gt;
                  &lt;a href="/engine.aspx/en-us/text/home"&gt;[Text
Only]&lt;/a&gt;
               &lt;/div&gt;

               &lt;div id="centerImg"&gt;
                  &lt;img src="/pub/en-us/images/clear-path-soon.jpg"
alt="Clear Direction Coming Soon." width="712" height="223" /&gt;
               &lt;/div&gt;

               &lt;p&gt;The clear choice for web design in blah blah, is
coming soon...757.561.3596 
               &lt;a href="Mailto://Sales@ blah blah.com"&gt;Sales@ blah
blah.com&lt;/a&gt;
               &lt;/p&gt;
            &lt;/center&gt;</PageBody><Meta>
					<Title> blah blah Web Design</Title>
					<FriendlyName> blah blah Home Page:
en-EN</FriendlyName>
					<Activate date="2000-01-15T12:00:00"
/>
					<Expires date="2005-01-15T12:00:00"
/>
					<Creator> blah blah </Creator>
					<MetaData name="copyright" value="
blah blah " />
					<Description>This is a description
of this page</Description>
					<Keywords />
				</Meta><PageBody>
            &lt;br /&gt;
            &lt;center&gt;
               &lt;div id="TextOnlyLink"&gt;
                  &lt;a href="/engine.aspx/en-us/text/home"&gt;[Text
Only]&lt;/a&gt;
               &lt;/div&gt;

               &lt;div id="centerImg"&gt;
                  &lt;img src="/pub/en-us/images/clear-path-soon.jpg"
alt="Clear Direction Coming Soon." width="712" height="223" /&gt;
               &lt;/div&gt;

               &lt;p&gt;The clear choice for web design in blah blah, is
coming soon...757.561.3596 
               &lt;a href="Mailto://Sales@ blah blah.com"&gt;Sales@ blah
blah.com&lt;/a&gt;
               &lt;/p&gt;
            &lt;/center&gt;</PageBody></iThink.ePulp>

The original Page.xml file is this. I had changed the tag names to protect
the innocent (bad joke)


<?xml version="1.0" encoding="UTF-8"?>
<iThink.ePulp>
	<Page id="somepageid" version="1.0" published="1.0" current="1.0">
		<Content>
			<Local id="en-US">
				<Meta>
					<Title> blah blah Web Design</Title>
					<FriendlyName> blah blah Home Page:
en-EN</FriendlyName>
					<Activate
date="2000-01-15T12:00:00"/>
					<Expires
date="2005-01-15T12:00:00"/>
					<Creator> blah blah </Creator>
					<MetaData name="copyright" value="
blah blah "/>
					<Description>This is a description
of this page</Description>
					<Keywords/>
				</Meta>
				<PageBody><![CDATA[
            <br />
            <center>
               <div id="TextOnlyLink">
                  <a href="/engine.aspx/en-us/text/home">[Text Only]</a>
               </div>

               <div id="centerImg">
                  <img src="/pub/en-us/images/clear-path-soon.jpg"
alt="Clear Direction Coming Soon." width="712" height="223" />
               </div>

               <p>The clear choice for web design in blah blah, is coming
soon...757.561.3596 
               <a href="Mailto://Sales@ blah blah.com">Sales@ blah
blah.com</a>
               </p>
            </center>]]></PageBody>
			</Local>
			<Local id="es-ES">
				<Meta>
					<Title>Diseqo Del Web De
Williamsburg</Title>
					<FriendlyName> blah blah Home Page:
es-ES</FriendlyName>
					<Activate
date="2000-01-15T12:00:00"/>
					<Expires
date="2005-01-15T12:00:00"/>
					<Creator>blah blah</Creator>
					<MetaData name="copyright"
value="blah blah"/>
					<Description>Ista es una descripcisn
de esta pagina</Description>
					<Keywords/>
				</Meta>
				<PageBody><![CDATA[
            <br />

            <br />

            <center>
               <div id="TextOnlyLink">
                  <a href="/engine.aspx/en-us/text/home">[Texto
Solamente]</a>
               </div>

               <div id="centerImg">
                  <img src="/pub/en-us/images/clear-path-soon.jpg"
alt="Direccisn Clara Que viene Pronto." width="712" height="223" />
               </div>

               <p>La opcisn clara para el diseqo de la tela en blah blah,
esta viniendo pronto... blah blah
               <a href="Mailto://Sales@ blah blah.com">Sales@ blah
blah.com</a>
               </p>
            </center>]]></PageBody>
			</Local>
		</Content>
	</Page>
	<PageTree/>
</iThink.ePulp>









-----Original Message-----
From: Pieter Reint Siegers Kort [mailto:pieter.siegers@xxxxxxxxxxx] 
Sent: Wednesday, April 07, 2004 6:40 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Merge Question Take 2 (complex)

No, I asked what your merged XML looks like, not the output you want to
obtain, you already stated that in your original email... so, let us first
get things clear:

Given your merger xml:

<files>
	<file>home.xml</file>
	<file>Event.xml</file>
</files>

Would it be something like this?

<?xml version="1.0" encoding="UTF-8"?>
<files>
<file>
<Page id="somepageid" version="1.0" published="1.0" current="1.0">
	<Content>
		<Local local="en-US">
			...lots of sub stuff in "English"
		</Local>
		<Local local="es-ES">
		...lots of sub stuff in "Spanish"
		</Local>
	</Content>
</Page>
</file>
<file>
<Page>
	<News>
		<event>
			<Title local="en-US">English name</Title>
			<Title local="es-ES">Spanish name</Title>
		<details>some non language specific details</details>
		</event>
		<event>
			<Title local="en-US">English name</Title>
			<Title local="es-ES">Spanish name</Title>
		<details>some non language specific details</details>
		</event>
	</News>
</Page>
</file>
</files> 


<prs/>
http://www.pietsieg.com
http://www.pietsieg.com/dotnetnuke
Contributor on www.ASPToday.com
Co-author on "Professional ASP.NET XML with C#", July 2002 by Wrox Press

-----Original Message-----
From: John Hamman [mailto:John@xxxxxxxxxxxxxxxxx] 
Sent: Wednesday, April 07, 2004 5:28 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Merge Question Take 2 (complex)

Like this,
<Page id="somepageid" version="1.0" published="1.0" current="1.0">
		<Content>
			<Local local="en-US">
				...lots of sub stuff in "English"
			</Local >
		</Content>
<News>
		<event>
			<Title local="en-US">English name</Title>	
			<details>some non language specific
details</details>
		</event>
		<event>
			<Title local="en-US">English name</Title>	
			<details>some non language specific
details</details>
		</event>
	</News>
</Page>

-----Original Message-----
From: Pieter Reint Siegers Kort [mailto:pieter.siegers@xxxxxxxxxxx]
Sent: Wednesday, April 07, 2004 6:17 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Merge Question Take 2 (complex)

Hi John,

1. Note that your page.xml is not well-formed (you must close the 2nd
<Local> node element).

2. Your xpath expression is also not correct (the 'id' should be 'local'):

<xsl:copy-of
select="document(file)//Page/Content/Local[@local='en-US']/text()"/>

3. You could simply pass in a parameter 'local' with values either 'en-US'
or 'en-ES', and in your stylesheet using <xsl:if> or <xsl:choose> you can
filter out what you do not want in the output.

Q: What does your merged XML look like?

<prs/>
http://www.pietsieg.com
http://www.pietsieg.com/dotnetnuke
Contributor on www.ASPToday.com
Co-author on "Professional ASP.NET XML with C#", July 2002 by Wrox Press

-----Original Message-----
From: John Hamman [mailto:John@xxxxxxxxxxxxxxxxx]
Sent: Wednesday, April 07, 2004 2:27 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Merge Question Take 2 (complex)

Ok I have successfully merged 2 documents that had the same Root namespace.
But now I have a more complext Merge question.
Now one of my xml docs has the following sytax


Page.xml
<?xml version="1.0" encoding="UTF-8"?>
	<Page id="somepageid" version="1.0" published="1.0" current="1.0">
		<Content>
			<Local local="en-US">
				...lots of sub stuff in "English"
			</Local >
			<Local local="es-ES">
			...lots of sub stuff in "Spanish"
		</Content>
	</Page>

Event.xml
<Page>
	<News>
		<event>
			<Title local="en-US">English name</Title>	
			<Title local="es-ES">Spanish name</Title>	
		<details>some non language specific details</details>
		</event>
		<event>
			<Title local="en-US">English name</Title>	
			<Title local="es-ES">Spanish name</Title>	
		<details>some non language specific details</details>
		</event>
	</News>
</Page>

Ok I have a merge xml too
<files>
	<file>home.xml</file>
	<file>Event.xml</file>
</files>

Merger.xsl
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:template match="files">
    <Page>
      <xsl:copy-of
select="document(file)//Page/Content/Local[@id='en-US']/*"/>
    </ Page >
  </xsl:template>
</xsl:stylesheet>

And I want to merge them together, BUT I want only certain information in
this merger so that the output is like this. This is what it would look like
if I only wanted the English information.


<Page id="somepageid" version="1.0" published="1.0" current="1.0">
		<Content>
			<Local local="en-US">
				...lots of sub stuff in "English"
			</Local >
		</Content>
<News>
		<event>
			<Title local="en-US">English name</Title>	
			<details>some non language specific
details</details>
		</event>
		<event>
			<Title local="en-US">English name</Title>	
			<details>some non language specific
details</details>
		</event>
	</News>
</Page>



Is this possible like this. Would it be more possible if I changed the way
the xml is in the page.xml and event.xml docs?
Thanks
john

Current Thread