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

Re: combine xml files

Subject: Re: combine xml files
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Wed, 10 Apr 2002 15:01:24 -0400
xslt combine xml files
[Ming]

>
> I'm very new to XSLT and here is one of my problems. I have several xml
files
> with same structure.
>
> <xml>
>   <db>
>      <title>  title in db </title>
>      <author> author names </author>
>   </db>
> </xml>
>
> And what I want is to output to html with the formats for each xml record:
>
> Title: title in db
> Author: author names
>
> Do you have any suggestions on what I should do this? Should I process the
xml
> files in my java servlet, recombine my xml files into one and pass to my
> stylesheet or process each xml file separately? The second case produce a
> problem of generating <html><body> </body></html> for each record. So, in
my
> final html page, the <html><body> </body></html> tags appear for each
record
> which doesn't seem right to me.
>

I would create an xml file that contains the name of each file.  It might
look like this:

<files>
    <file name='xml1.xml'/>
    <file name='xml2.xml'/>
</files>

I would use that file as the source.   I would do something like

<xsl:for-each select='files/file'>
<tr><td><xsl:value-of select='document(@name)/xml/db/title'/></td></tr>
</xsl:for-each>

You can probably create a list of files using a batch file or a shell
script, if they are all in the same set of directories.

BTW, the use of element names starting with "xml" and its variations is
reserved for W3C use.  Best not to use it even if your processor doesn't
complain about it.

Cheers,

Tom P


 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.