This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Working code to do what you want is the following:
generateError() is just a method that takes a String and parses that into an HTML template to generate a custom error page. The XML to be processed and the NAME of the XSL file are passed in as request parameters. The servlet caches the precompiled XSL sheets in order to speed up performance on subsequent uses of the same XSL (depending on your parser this can make requests after the first one for a particular XSL file up to a hundred times faster according to tests I did).
Joined: Aug 18, 2004
I tried testing your xsl (in xmlspy) using the following xml file.
I ran the transformation as is and it gave me an empty page. It worked when I put a value in <title></title> element. Check the markup in the head section.
Joined: May 09, 2004
hi Sheldon, thankyou for going to so much trouble to work it out. that made it work for me too. i didn't realise that a title was a mandatory item. thankyou, thankyou, thankyou!!