Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tools for debugging xslt

I have a Java servlet which generates xml, translates it with an xslt stylesheet, and then displays the resulting HTML. This is the first time I've worked with xslt. What's a good way to debug xslt? I have (or can get) some sample XML files to apply the transform too. But I'm not really even sure of the syntax so something that would give me syntax warnings would be great.

like image 686
Jonathan Adelson Avatar asked Oct 20 '08 13:10

Jonathan Adelson


People also ask

How do I debug a XSLT file?

To start debugging an XSLT applicationPress F11 to step into the XSLT code. The XSLT style sheet is loaded in a new document window and the XSLT debugger starts. Alternatively, you can add a break point to the style sheet and run your application.

Can we debug XSLT in eclipse?

XSLT debugging is handled by the eclipse platforms debugging framework support as outlined in the "Program Debug and Launch Support". Common operations like stepping into (F5), stepping over (F6), pausing, running to a breakpoint, and relaunching are supported.

How do I run an XSLT on Altova?

Prior to initiating an XSLT or XQuery transformation, click the “Enable Back-mapping” button on the XMLSpy toolbar. XMLSpy will give you the option to tile the source and output documents so you can easily visualize related elements in one window. Then, run the transformation.

How do I debug an XML file?

Select the XSL and XML files you want to work with and click Debug > XSL Transformation from the pop-up menu. If you want to transform an XML file or debug an XSL file and indicate specific information about the transformation or debugging process, you should create a Run or Debug configuration.


2 Answers

If you want to do "printf-style" debugging and don't want to litter your output with debugging data, use the <xsl:message> tag to generate debugging output while processing the stylesheet. With the terminate="yes" attribute you can even halt the processing of the stylesheet.

like image 183
chiborg Avatar answered Sep 24 '22 21:09

chiborg


Xalan should give you useful errors when you try to use an invalid XSLT. If you want something more powerful, one option for debugging XSLT is Oxygen XML Editor. It is integrated with Xalan and Saxon transform engines. Its debugging mode allows you to set breakpoints, watch variables, and provides other such basic debugging functionality. It may be overkill for you want, but it's very good.

like image 33
James Sulak Avatar answered Sep 25 '22 21:09

James Sulak