• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

xsl templates

 
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please read the archives from this URL, it will sure suit ur need.
Rgds
Balaji
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic