File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xsl templates

 
shankar vembu
Ranch Hand
Posts: 309
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Can I import code from other xml files using XSLT. For example I have two files A.xml,B.xml. Now I would like to modify(include) A.xml with code that is present in B.xml. How can I achieve it using an xsl??
If I define templates, then I would have to copy the code present in B.xml into my template. But I dont wanna do this. Is there any way so that I can just modify one file with another using an XSL without duplicating code.
shankar,
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read the archives from this URL, it will sure suit ur need.
Rgds
Balaji
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just learned this recently, and made an example available on the web. If you need to do complicated manipulation on the multi-document, you might need to use vender specific extention. This example might of some help.
http://bobcat.webappcabaret.net/javachina/faq/xslt_01.htm#xslt_ex_Q01
See the result and source first if you like:
http://bobcat.webappcabaret.net/javachina/faq/xslt_ex_Q01_result.htm
http://bobcat.webappcabaret.net/javachina/faq/xslt_ex_Q01_source.htm
 
shankar vembu
Ranch Hand
Posts: 309
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Balaji and Roseanne,
Thanx for the replies. I went thru the links you mentioned.But i am not sure whether they would solve my problem.I need to just include an xml file(alongwith tags) in another xml file thereby producing a (bigger) output xml.Example:
source file
<root>
<include>
<file>inc.xml</file>
</include>
</root>
inc.xml
<firm>
<employee>
<name>XYZ</name>
<age>21</age>
</employee>
</firm>
output file
<root>
<name>XYZ</name>
<age>21</age>
</root>
So,I want to pick some tags from an xml file and add(include) them in another.But in the examples mentioned in the urls, the content of xml files are being merged to produce an html output.Am I missing something here???
Shankar.
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first part of my xslt code is more than sufficient to solve your problem. You don't even need the extention. However, you do need to write a few lines of code, copying will not work.
Balaji's link is very specific to your question, however, you still need to read them, and digest. Then you need to apply what you learned from there, and write a few lines of your own code.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic