RE: [xsl] My first try at XSL..can someone give me a few pointers?

Subject: RE: [xsl] My first try at XSL..can someone give me a few pointers?
From: "Kevin Duffey" <kevin.duffey@xxxxxxxx>
Date: Sun, 7 Jan 2001 16:22:48 -0800
My co-worker just bought the book from Kay, and I will purchase that one as
well, and the other. Thanks for the pointers.

You said the code looks alright..the 4 lines of TrAX API calls being made
look correct? Do you have perhaps a snippet that you know would work that I
could look at?

By chance do you know what sort of performance hit will be taken when using
XSLT compared to just a JSP page returned dynamcially? Is it 2x as long for
a page to be returned, 4x, or only say..1.5x? I am trying to gauge what sort
of performance can be expected compared to using just JSP. I eventually want
to return WML, PDF and RTF, but I don't want to see a major slowdown in our
site when using this technology.


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Max Dunn
> Sent: Sunday, January 07, 2001 4:02 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] My first try at XSL..can someone give me a few
> pointers?
> Michael Kay's XSLT Programmer's reference is pretty much a
> required text for
> XSL programmers, and does explain the full syntax of XSLT and XPATH.
> Another good book that covers XSLFO as well as XSLT is the XSL
> Companion by
> Neil Bradley.  Also see the list of online XSL resources at
> It would appear that your XML/XSL is OK, it is probably not being passed
> into the program correctly.
> Max
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Kevin Duffey
> Sent: Sunday, January 07, 2001 3:18 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] My first try at XSL..can someone give me a few pointers?
> Hi there,
> Just joined this list in hopes to figure out a few things.
> First..what is a
> recommended XSL book? I see a few that are coming out soon, but is there a
> good one right now that explains the full syntax of XSL and XPATH? Also,
> being that I am using Xalan (the latest build as of three days ago), it
> supports something called TrAX, which I am trying to use to
> is a
> Java API or something and right now I seem to be using only 4
> lines of code.
> I pass in two StreamSources, one of which is XML, and the other
> of which is
> XSL. I don't know if how I am doing this is correct or not, but here is a
> very basic XML file I have, and the XSL I am using to convert it
> to HTML. If
> someone could just let me know if this should work or not that would be
> great. I keep getting an error saying the XML file needs to have a root
> element, and I am not sure what it is saying.
> XML:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <OrderBuilder>
>   <Name>HELLO</Name>
> </OrderBuilder>
> XSL:
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="";>
> <xsl:output method="html"/>
>   <xsl:template match="OrderBuilder">
>     <html>
>       <body>
>         <xsl:apply-templates/>
>       </body>
>     </html>
>   </xsl:template>
>   <xsl:template match="Name">
>     <xsl:apply-templates/>
>   </xsl:template>
> </xsl:stylesheet>
> Lastly, what I am trying to do is something like the cocoon project, but
> much smaller in size. I have a working, very simple mvc framework using a
> singel controller servlet and a few other helper classes. It is similar to
> Struts, but much smaller in size and a little bit different. I added an
> xslControllerServlet, which instead of forwarding to a JSP page, it grabs
> the output of the JSP page (which results in XML well-formed..I
> think), and
> applies an XSL to it, to transform it. Here is the last bit of code, but I
> can supply the whole thing if necessary. I don't want anyone to
> do the whole
> thing for me..I just want to know if what I read from the XSL stuff online
> if what I am doing should work, or am I way off the mark here. From what I
> gathered, the TrAX api is supposed to make the process very simple..simply
> supply the xml stream and xsl stream, and the result is put in the output
> stream you supply. Here is the code snippet.
>       String urlPrefix = "http://localhost/";;
>       URL url = new URL(urlPrefix + "xsl/demo.jsp");
>       HttpURLConnection urlConnection = (HttpURLConnection)
> url.openConnection();
>       InputStream is = urlConnection.getInputStream();
>       xmlStream = new StreamSource(is);
>       TransformerFactory tFactory = TransformerFactory.newInstance();
>       Transformer transformer = tFactory.newTransformer(xslStream);
>       transformer.transform(xmlStream, new
> StreamResult(response.getOutputStream()));
> That above is the portion that grabs the JSP page output (as if a web
> browser accessed it so that I can dynamically create the XML output it
> returns), and then calls the TrAX api transform() method with the
> xmlStream
> and uses the HttpServletResponse outputstream for the output.
> I set the response.setContentType() to the xsl output (which in my case
> right always HTML). I should I need to do a
> response.flush()
> call or anything..or should the above work and send the transformed output
> to the browser that requested the initial page?
> Thanks for any help. While not a big deal..if anyone would like my simple
> mvc framework with source, I am happy to give it out. A few things it
> does..much like Struts, is supports auto-bean population, a single xml
> config file mapping for all actions (and multiple forwards per
> action, each
> forward having the ability to specify an XSL page to use to transform it;
> the auto-population actually works on nested objects, so that if
> you have a
> JavaBean with an object in it as a field, you can auto-populate
> that object
> (and nested objects, etc), which allows you to use "pass-through"
> abilities
> (ask for more details if you would like). It also uses reflection
> to make it
> very easy to know what action method is being called on any page (or any
> button that submits a form or any href link).
> Anyways..thanks for any help.
>  XSL-List info and archive:
>  XSL-List info and archive:

 XSL-List info and archive:

Current Thread