xsl-list
[Top] [All Lists]

RE: Merge Process on Unix PC

2005-09-29 22:40:19
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







--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>
  • RE: Merge Process on Unix PC, Shailesh Shinde <=