Subject: [xsl] Multiple XML Files to One PDF From: "Patel, Viral" <viral.patel@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 29 Apr 2004 09:39:00 -0500 |
Hi, I was working on converting multiple XMLs to one PDF file. As we know that Apache/Xalan Transformer only takes in one xml file and one xsl file as parameters. Since I have multiple xml files, I had some difficulties in achieveing that at first but once I thought a little outside-of-the-box and with some assistance from others on this list, I got what I wanted. I am just posting the solution in case anyone else wants to use it. You would have to tweak it based on your needs. Bascially this is what I did and I am sure it will spawn some ideas to best fit your needs. 1. I created a XML structure (it could be created as a String or as a temporary xml file) of all the xml documents that I wanted to transform that looked something like: <root> <file xmlfile="aaa.xml" xslfile="aaa.xsl"/> <file xmlfile="bbb.xml" xslfile="bbb.xsl"/> <file xmlfile="ccc.xml" xslfile="ccc.xsl"/> ... ... ... </root> NOTE: I also included the XSL file name so I know which XSL to use to do the transformation for a given xml file. 2. I created one main XSL (we'll call it main.xsl). * I passed the XML structure (again either as a File or as a String) that you created in step 1 (for simplicity, we'll call it xmlFileListStructure) and the main.xsl to the transformer. * In this main.xsl, I went through each "root/file" node and let the main.xsl load that xml file using the "xmlfile" attribute for that node. I used the document function to load the xml file. * You could do some additional functions using the xslfile attribute if needed. Its totally optional. So basically all you are passing to the transformer is one XML Structure (from step 1) and one XSL file (main.xsl). Those are the 2 standard parameters that the Transformer will take. In a nutshell, you are fooling the Transformer to think that only one xml file and one xsl file is being processed. But your XSL loads each xml file individually and processes all them to output one PDF. Let me know if you have any questions. Thanks, Viral Patel.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Sort by Parameters-Child , Bret | Thread | RE: AW: AW: AW: [xsl] tomcat web se, Passin, Tom |
Re: AW: AW: AW: AW: [xsl] tomcat we, Emmanuil Batsis (Man | Date | RE: [xsl] Create personal functions, Michael Kay |
Month |