Click here to Skip to main content
15,890,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello my Seniors,

I am beginner in the industry and has been given the task to create XSLT file from one of the clients Microsoft Word template and guess what I am struggling :-(


I dont want to sound too demanding, but if you can guide me I will be able to get this done.

I have following inputs given – Data XML with values, need to use XSLT 1.0 version, Microsoft Word Template (report to be looked like).

So I need to sort of reverse engineer my MS word report and write a xsl file. My application does the transformation using its own engine to XHTML(Word) output.


I can sent the MS word template. Please guide and advise.


Thanks in advance

AB
Posted

1 solution

How about:

  1. get/create a HTML version of your Template file first
  2. create an XSLT file that produces that HTML template and add all the required xml data as <pre>...</pre>
  3. create templates in XSLT to replace the preformatted data from above with nicely formatted data

This assumes you have sufficient knowledge on XML, XSLT and HTML. If you have not sufficient knowledge of this, you have to get that basic knowlege first. Nobody on this site will do your work. If you have a concrete question on some parts you are struggling, you will get quick help. But for sure not work out-sourced here...
Cheers
Andi
 
Share this answer
 
Comments
AB-ishere 11-Oct-13 5:40am    
Hi Andries,

Thanks for the feedback.

I will definetely start again from the points you have mentioned.

I did created my XSLT file and the output came close to the template I need.The only issue I am facing on the output is

- Whenever my application generates this msword rendered output, its in potrait and I have to manually change the orientation to Landscape all time.
- How to add headers and footers

I dont know if I need to paste my xml or xslt file here for more info

Thanks again
Andreas Gieriet 11-Oct-13 11:13am    
Sorry for my ignorance, but I might misunderstand your situation. You have as input XML+XSLT, and as output (X)HTML, right? What has MSWord to do with that? I.e. if MSWord is involved, then only in the sense that it exports the document as HTML, right?
So, if you have that (X)HTML template file and open it in a web brownser, do you see any "orientation"?
Cheers
Andi
AB-ishere 14-Oct-13 2:21am    
Hi Andi,

You are right. The application does transformation and actually generates a (X)HTML output in the browser with MSWord session in the browser. In our application we have an option to either get the ouput in original XHTML, HTML or MSWord. When I select MSWord, it generates the output in browser but with MSword interface so that endusers can edit the report. But this report when generated have "Potrait" orientation selected by default. This chops my report and end-users has to change it to "Landscape" and then report looks fine. I dont know whether we can add some parameters in xslt template so it renders output in landscape.Sorry if I am still not making it clear.
Andreas Gieriet 14-Oct-13 2:40am    
I have no experience with your MSWord use case. But you might try to use the @page CSS definition. E.g.
<style type="text/css">
...
@page { size:landscape; }
...
</style>

The Browser will ignore it, but all page oriented devices should respect it. Is MSWord also respecting this?
Cheers
Andi
AB-ishere 14-Oct-13 5:28am    
Thanks for taking your time for replying.

I will check above and will reply back

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900