Altova Mailing List Archives

RE: [xsl] Any samples of client-side XSLT to generate webpages?

From: "Daniel Joshua" <daniel.joshua@------------>
Date: 7/27/2004 9:19:00 PM
Hi all,

I have not get any samples from anyone on the list yet.

Well here is what I done so far. As you can see I need help making it work
in both IE and Mozilla. (work on IE only) (works on
Mozilla only - currently need to manually add the '?transform=true', but I
might automate this later)

Here's the code that either writes out XML with a XSLT stylesheet or uses
saxon to transform into HTML.

  protected void writeDocument()
      boolean transform =
        InputStream inputStream =
+ _stylesheet);

        //_response.setContentType("'application/xhtml+xml"); // currently
most browsers do not support this yet

        //TODO: Add Caching
        TransformerFactory transformerFactory =
        Transformer transformer = transformerFactory.newTransformer(new
        transformer.transform(new JDOMSource(_document), new
        _document.addContent(0, new ProcessingInstruction("xml-stylesheet",
"type=\"text/xsl\" href=\"stylesheets/" + _stylesheet + "\""));


        XMLOutputter xmlOutputter = new
        xmlOutputter.output(_document, _response.getWriter());
    catch(Exception ex)
      throw new NestableRuntimeException("Failed to write document", ex);

Any help/suggestions/links/samples would be greatly appreciated. Thanks.


-----Original Message-----
From: Daniel Joshua [mailto:daniel.joshua@xxxxxxxxxxxx]
Sent: Monday, 26 July, 2004 12:46 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Any samples of client-side XSLT to generate webpages?

Hi all,

I am looking for samples (hopefully as part of a web site)
of web pages that use XSLT in a browser to generate the HTML
that is displayed.

Best would be pages that have forms. As I am encountering a problem
trying to submit a form in Mozilla using 'document.myForm.submit()'.
When I did a alert() to see the value of 'document' it returned
'XMLDocument' and 'document.forms' returned 'undefined'.

Currently, it works in IE using client-side transformation
(ContentType: "text/xml") and in Mozilla using server-side
transformation (ContentType: "text/html").

Also, I noticed in Mozilla's DOM Inspector that my '#document' had
two 'html' child nodes, the first was blank and the second had the
'head' and 'body' nodes and the namespace ''.
Any idea for this extra 'html' node?

I really would like to examine how other people do XSLT in browsers,
thus the reason I am looking for samples. Or should I do all my
transformation on the server-side?

By the way, I am using Mozilla 1.8a2 and IE 6.0.



These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.