This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
i'm trying to convert an XML document with XSLT and all I'm getting is a blank page (no error msg's or anything). my code is
sorry, I don't know much about the conversion process for XSLT. am i doing something wrong here?
Ta
Balan Raj
Ranch Hand
Joined: Aug 26, 2003
Posts: 74
posted
0
Bron, I dont see you using the "RESULT" of the transformation.
The process is something like
In your case, I dont see "out" being set at all..
Bron Czimes
Ranch Hand
Joined: May 09, 2004
Posts: 44
posted
0
sorry, i don't think i understand. my XSLT actually creates a web page (sorry, i didn't include my XSLT code before). so as far as I was aware i'm unable to use out in this context.
my XSLT code is this
does that help any more?
Bron Czimes
Ranch Hand
Joined: May 09, 2004
Posts: 44
posted
0
btw, i know that I am missing a <tr> tag near the top there, but I have fixed that and I still have the same problem....
Sheldon Fernandes
Ranch Hand
Joined: Aug 18, 2004
Posts: 157
posted
0
Check the content of the xml (messageDocument) used in the transformation.
If it is correct, try doing the transformation from the command line using the xsl and an xml file.
My xsl is a bit rusty, shouldn't the template contain a forward slash? I could be wrong here. <xsl:template match="/flight"> [EDIT: As I had suspected, I got this one wrong]
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).
42
Sheldon Fernandes
Ranch Hand
Joined: Aug 18, 2004
Posts: 157
posted
0
Hi Bron,
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.
Sheldon Fernandes
Bron Czimes
Ranch Hand
Joined: May 09, 2004
Posts: 44
posted
0
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!!