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

RE: Merge Process on Unix PC

Subject: RE: Merge Process on Unix PC
From: "Shailesh Shinde" <shailesh@xxxxxxxxxxxx>
Date: Fri, 30 Sep 2005 11:10:19 +0530
unix merge
Hi,

I have to do a merge process on Unix PC using Saxon. 

Input xml file:

"Input.xml"
<?xml version="1.0" encoding="UTF-8"?>
<helpdata>
<file fileloc="Test/Panel/xml/ftp1.xml" />
<file fileloc=" Test/Panel/xml/ftp2.xml" />
</helpdata>

There is a Test/Panel/xml folder in which my xml files will be there.

Input xsl for the same is:

"Input.xsl"
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="UTF-8"
omit-xml-declaration="no"/>
<xsl:template match="/">
<xsl:element name="help">
<xsl:attribute name='noNamespaceSchemaLocation'
namespace="http://www.w3.org/2001/XMLSchema-instance">
<xsl:text>master_main.xsd</xsl:text></xsl:attribute >
<product name="trical" major_release="10" minor_release="0">
<onlinehelp>
<xsl:for-each select="helpdata/file">
<fileloc>
<xsl:attribute name="path">
<xsl:value-of
select="concat(substring-before(concat(substring-before(@fileloc,'/xml/'),'/
html/',substring-after(@fileloc,'/xml/')),'.xml'),'.htm')"/>
</xsl:attribute><xsl:text>&#13;</xsl:text>	
<xsl:apply-templates select="document(@fileloc)/onlinehelp/topic"/>
</fileloc>
</xsl:for-each>
</onlinehelp>
</product>
</xsl:element>
</xsl:template>

I am merging xml files with the above XSL.

My ftp1.xml is like:

<?xml version="1.0" encoding="UTF-8"?>
<onlinehelp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../main.xsd">
<topic type="concept">
<paragraph style="lessspace">ABCDEFGHIJKLMNOP</paragraph>
<paragraph style="lessspace">123456789</paragraph>
</topic>
</onlinehelp>

My ftp2.xml is like:

<?xml version="1.0" encoding="UTF-8"?>
<onlinehelp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../main.xsd">
<topic type="concept">
<paragraph style="lessspace">QRSTUVWXYZ</paragraph>
<paragraph style="lessspace">10111213141516171819</paragraph>
</topic>
</onlinehelp>

The final output file which I need is:

"Panel.xml"

<?xml version="1.0" encoding="UTF-8"?>
<help>
<product name=" trical" major_release="10" minor_release="0">
<onlinehelp>
<fileloc path="Test/Panel/xml/ftp1.htm">
<topic type="concept">
<paragraph style="lessspace">ABCDEFGHIJKLMNOP</paragraph>
<paragraph style="lessspace">123456789</paragraph>
</topic>
</fileloc>
<fileloc path="Test/Panel/xml/ftp2.htm">
<topic type="concept">
<paragraph style="lessspace">QRSTUVWXYZ</paragraph>
<paragraph style="lessspace">10111213141516171819</paragraph>
</topic>
</fileloc>
</onlinehelp>
</product>
</help>

If u see final output file it merges the topic in the fileloc as in
input.xml.

For the same I have Merge.xml file which contains the following:

"Merge.xml"

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="MyTask" basedir="." default="build">
<property name="dir.in" value="E:\Testing\"/>
<target name="build" depends="Panel"/>

<target name="Panel">
	<exec dir="${dir.in}" executable="cmd" failonerror="true">
		<arg line="/c msxsl -o Panel.xml input.xml Input.xsl"/>
	</exec>
</target>
</project>

Here I have used msxsl for transformation; now on Unix PC msxsl is not there
I have to do this process using Saxon.

What I do in this case.

Thanks,
Shailesh

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.