Hi, I can say ur help will be appreciated very well,Becoz ,We are at designing stage. Is there any processer/parser to generate .xsl/.xslt files by accepting .xml files as input. If it is there , It is easier to generate .html files using XT processer. Becoz i am sick of writing .xsl .xslt and .html files from .xml files. If i want to use this .html file in JSP file as presentation how should i approach?. AND How should i write a servlet/jsp file by using (.xml and .xsl/.xslt) files to generage .html content as output and input to browser. Your help will be aprreciated. raya.ku
Is there any processer/parser to generate .xsl/.xslt files by accepting .xml files as input. If it is there , It is easier to generate .html files using XT processer. Becoz i am sick of writing .xsl .xslt and .html files from .xml files. Raya, it�s not clear what level of control you have on your XML and HTML files. Do you have predefined HTML file for each XML, so you have to convert to this particular HTML? If not, and if all you need is somehow show your XML, you can write one generic XSLT which will, for example, translate any element into <p>element content</p> or something like this. If you do have predefined HTML, then I am not sure you can 100% automatize this task. There always will be need to tell an automat which XML tags corresponds to which piece of HTML. Perhaps there are tools which allow you to do it in run time via GUI or some kind of script, check this: http://www.xmlsoftware.com/convert/ Another possibility: if you have a control on how your XML files are generated, you can modify this process by including presentation information in XML document itself. This is described in XML Journal, vol. 2, issue 3, p.32 something like:
and then have one generic XSLT which will produce HTML output (or another XSLT, or even Java program; the article I mentioned describes Java program generation from XSLT ) How should i write a servlet/jsp file by using (.xml and .xsl/.xslt) files to generage .html content as output and input to browser. Usually you simply call your XSLT processor and tell it your input XML and XSL files. For example with Xalan and Jakarta taglib you would write:
Is there any processer/parser to generate .xsl/.xslt files by accepting .xml files as input. What kind of xml files as input? Or do you mean what Mapraputa appears to think you mean and do you have .html templates/examples as a starting point? If not, and you mean what you write, there certainly is a processor which may be able to generate .xsl files from your .xml input. It's called XSLT (remember, an .xsl file is a valid xml file, and can itself be generated using a stylesheet). It may even be able to generate your .html. Whether it is feasible depends on what information is present in your .xml input. I'd like to add that the Orion application server comes with Xalan and makes the XSLT processing very smooth indeed. Just code your JSP to generate XML with the appropriate stylesheet link. Orion comes preconfigured to recognise this, puts it through Xalan and sends the generated HTML to the browser. When I first started to dabble in XSLT, I thought that was incredibly cool - Peter
Peter den Haan
Joined: Apr 20, 2000
Originally posted by Mapraputa Is: [...] if you have a control on how your XML files are generated, you can modify this process by including presentation information in XML document itself.
Mapraputa, doesn't this ruin the division of responsibilities between the stylesheet and the XML files? Presumably, the stylesheet is there to generate the visual formatting. By including presentation information in the XML file, you start to couple the XML file pretty tightly to the layout and you lose all the advantages of an XML + XSLT -> HTML setup. Or am I missing something? - Peter
Leverager of our synergies
Joined: Aug 26, 2000
Peter, thanks for disagreement I think that XML + some metadata about how the data should be rendered is not so bad design decision. It�s something between 100% data + layout coupling and 100% separating. By putting such information in XML document we do not actually tie data to representation, it�s still possible to have various XSLT which will simply ignore this meta information and produce any other desired output. We just provide recommendations (or, if you want, default representation) how data could be shown. I suggested such trick based on Raya�s wish to get rid of XSLT creative writing process Unfortunately, we do not see the whole picture: what all those XML document came from? Do they all have different structure? What kind of processing is required to show them as HTML? If there is no need to select/rearrange elements, then CSS would suffice. Raya, if you could give us more information, we hopefully could say something more appropriate to your task.