File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes parsing in Xalan Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "parsing in Xalan" Watch "parsing in Xalan" New topic

parsing in Xalan

Murad Iqbal
Ranch Hand

Joined: Dec 09, 2003
Posts: 90
Guys! I need to transform an XML document to HTML. However, as there are many different XML documents that I need to transform I do not and cannot maintain a CSS or an XSL for each of them. Therefore, I am sacrificing that cosmetic finishing which is acceptable. The HTML i get is also acceptable. However, the javax.xml.transform.Transformer class provided by Xalan, which I am using for transformation produces lot of attributes and places them before the html tag in the generated HTML. This is how I create my transformer, tFactory.newTransformer().

This effect is removed when I use an XSL when creating a transformer class through tFactory.newTransformer(xslDocument) and only the correct HTML is produced. If I dont pass an xsl, it gives me unneeded stuff(comments) some of which I paste here. Please inform how can I remove this unnecessary data?

Black = #000000 Green = #008000
Silver = #C0C0C0 Lime = #00FF00
Gray = #808080 Olive = #808000
White = #FFFFFF Yellow = #FFFF00
Maroon = #800000 Navy = #000080
Red = #FF0000 Blue = #0000FF
Purple = #800080 Teal = #008080
Fuchsia= #FF00FF Aqua = #00FFFF
--><!--=================== Generic Attributes ===============================--><!-- core attributes common to most elements

id document-wide unique id
class space separated list of classes
style associated style info
title advisory title/amplification
--><!-- internationalization attributes
lang language code (backwards compatible)
xml:lang language code (as per XML 1.0 spec)
dir direction for weak/neutral text
--><!-- attributes for common UI events
onclick a pointer button was clicked
ondblclick a pointer button was double clicked
I agree. Here's the link:
subject: parsing in Xalan
It's not a secret anymore!