Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Merging 2 xml files and want to see the output how can I achieve.

 
Jasmine kaur
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everybody,

Iam working on the project where we need to merge1..n no of xml files and then want to see the out of these files in one flat file, i am doing a simple example to merge 2 xml files throught xslt but i cant understand how to see the output after doing these.Please see the code and tell me how to see the output after using xslt as Iam confused.
Step1:
<?xml version="1.0"?>
<!DOCTYPE BookSet [
<!ATTLIST Book id ID #IMPLIED>
]>
<BookSet>
<Book id="id1"><Name
>The wizard of OZ</Name></Book>
<Book id="id2"><Name
>Java Servlet Programming</Name></Book>
<Book id="id3"><Name
>John Coltrane Rage</Name></Book>
</BookSet>
Step 2:
<BookList>
<Book id="id1"/>
<Book id="id2"/>
</BookList>

Step 3:list1.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<all_files>
<xsl:copy-of select= "/" />
<xsl:copy-of select="document('doc1.xml')" />
<xsl:copy-of select="document('doc2.xml')" />
</all_files>
</xsl:template>
</xsl:stylesheet>
Now tell me how to see the output using xslt as i cant understand further.Thanks in advance .

Jasmine kaur

 
Paul Clapham
Sheriff
Posts: 21298
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm confused, too. To see the output of an XSL transformation I would use something like a text editor. Your transformation writes to a file, you look at the file with a text editor.

So obviously I'm misunderstanding the question. Could you clarify a bit the part where you are having trouble?
 
Jasmine kaur
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for responding , well my question is this as I need to merge 50 xml files into a single file and I get to know that we can achieve this by XSLT and later this files need to be converted into a single flat file either in excel file or txt file , to achieve this I made to xml files and used xslt to merge it and I want to use this XSLT file to see the output of the merge xml file which I cant achieve , can you assist me how can I achieve this and what are the posiibilties.
Thanks once again for helping me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic