This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes .Xls file for xml to html conversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark ".Xls file for xml to html conversion" Watch ".Xls file for xml to html conversion" New topic
Author

.Xls file for xml to html conversion

S Ag
Greenhorn

Joined: Jun 03, 2011
Posts: 1
I want to convert this xml file to a html file, can some one help me in writting the .xsl file required for conversion.

my xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<pmd version="4.2.2" timestamp="2011-06-02T15:23:33.822">
<file name="a.java">
<violation beginline="745" endline="768" begincolumn="17" endcolumn="17" rule="CollapsibleIfStatements" ruleset="Basic Rules" package="xyz" class="myclass.java" method="getSu" priority="3">
These nested if statements could be combined
</violation>
<violation beginline="880" endline="893" begincolumn="17" endcolumn="17" rule="CollapsibleIfStatements" ruleset="Basic Rules" package="xyz" class="myclass.java" method="getSur" priority="3">
These nested if statements could be combined
</violation>
</file>
</pmd>


Java Code for conversion is:

import javax.xml.transform.*;
import java.net.*;
import java.io.*;

public class Converter {
public static void main(String[] args) {
try {

TransformerFactory tFactory = TransformerFactory.newInstance();

Transformer transformer =
tFactory.newTransformer
(new javax.xml.transform.stream.StreamSource
("pmd.xsl"));

transformer.transform
(new javax.xml.transform.stream.StreamSource
("pmd.xml"),
new javax.xml.transform.stream.StreamResult
( new FileOutputStream("pmd.html")));
}
catch (Exception e) {
e.printStackTrace( );
}
}
}
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41062
    
  43
Seeing the Java code is not particularly useful; seeing the XSL code you have, and reading how it does not yet do what you need done, would be.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: .Xls file for xml to html conversion
 
Similar Threads
capturing inividaul elements in the xml file
PMD tool
Ruleset not found error while customizing PMD.
What is the following XSLT program doing ?
Transformation Problem For Arabic/French Character : HTML to XML