I'm having trouble with an XSL translation in Chrome. I was wondering if there any tools that would allow me to step through the style sheet to see where the problem is.
Debugging XSLT in Chrome
4.1k views Asked by Bryan At
2
There are 2 answers
0
On
- Use node tests to check the results of XPath queries.
- Use the document function to test file paths
- Use the JavaScript console to run XPath queries on the XML data source
- Use inline templates instead of
xsl:include
to eliminate path issues - Use comments to eliminate
xsl:include
statements referencing buggy templates - Use processing-instructions to comment blocks of code that have XML comments
- Use an embedded stylesheet to workaround same-origin policy restrictions
- Use
input
tags to printxsl:variable
values. - Use attribute value templates to print unknown values
- Use simplified stylesheets and parameterized XPath to modularize templates
- Use Opera as a cross-reference, since it shows line numbers in its XSLT error messages.
On linux there is a tool called xsltproc which takes an XSL and XML and outputs the transform.
It also shows context around errors.
I've found this most useful when I'm developing as I can test the result of my changes without the need to have a development server up and running. It just works.
However, I've noticed that the results of the transform can differ from that of Chrome for example. I don't know why this is, whether my transform was non-conforming, if Chrome is non-conforming, or if xsltproc is non-conforming.
EDIT My comment about differences between Chrome and xsltproc rendering the transform slightly differently is likely invalid.
So I guess some part of the xsl was being cached somehow (perhaps just the schema bit - totally guessing here)... hence why some debugging in Chrome would be super nice.