Debugging LIBXSLT

Here should go questions about transforming XML with XSLT and FOP.
Crispness
Posts: 9
Joined: Wed Jan 26, 2011 1:39 pm

Debugging LIBXSLT

Post by Crispness »

Hi

We have an online XSLT process using Nokogiri (libxsl) on Ruby-on-Rails and have a problem with one of our XSLT docs. It's a very recursive process turning 'flat' XML into neatly nested XML. The document runs fine locally here in Oxygen under Saxon 6.x and 9.x, and fine under Saxon 9.x in the online environment. But once we introduce Nokogiri into the mix, it falls over with:
runtime error: file /Users/<pathtotrunk>/data/xsl/v1/TextSections.xsl line 324 element param
xsltApplyXSLTTemplate: A potential infinite template recursion was detected.
You can adjust xsltMaxDepth (--maxdepth) in order to raise the maximum number of nested template calls and variables/params (currently set to 3000).

We have tried increasing xsltMaxDepth without success.

As the XSLT author, I would like to debug the xslt in Oxygen using libxsl and see if I can reproduce the error.

Is it possible to configure the Oxygen XSLT debugger to use libxsl?
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Debugging LIBXSLT

Post by adrian »

Hello,

Currently(v12.1) the Oxygen XSLT Debugger supports only the built-in Saxon(6.5.5, 9.x) and Xalan processors.

The error you are receiving("A potential infinite template recursion was detected.") could be caused by either:

- the maximum depth in templates stack of the debugger
Go to Options -> Preferences -> XML -> XSLT-FO-XQuery -> Debugger, and increase the value "Maximum depth in templates stack".

- a stack overflow caused by the XSLT engine.
To fix this you can increase Oxygen's stack size and try again.

To increase the stack size in Windows/Linux have to edit the oxygen.vmoptions file from the Oxygen installation folder and on the last line add the -Xss argument. e.g. -Xss1m
If this doesn't seem to be enough you can further increase it: -Xss2m

Don't go further than '2m' unless absolutely necessary because a stack is allocated for each running thread inside Oxygen and there can be tenths of such threads each consuming this amount of memory just to be started.

In Windows Vista/7 you will first have to copy the 'oxygen.vmoptions' file to your Desktop(or another folder with write access), modify it there and then copy it back to the Oxygen installation folder replacing the original file.


On the Mac OS X platform you have to Ctrl-click(or right click) on the Oxygen application icon(Oxygen.app) in Finder and from the pop-up menu select Show Package Contents. Then navigate to the Contents directory and open for editing the Info.plist file. You can open it with either the 'Property List Editor' or with 'TextEdit'.
Look for the key VMOptions and adjust the -Xss argument(the default value is -Xss650k) to a larger value. e.g. -Xss1m


If you start Oxygen with the command line startup script(oxygen.bat, oxygen.sh or oxygenMac.sh) then you will have to adjust the -Xss argument found on the last lines of the said script.

In all cases restart Oxygen for the new stack size to apply.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Crispness
Posts: 9
Joined: Wed Jan 26, 2011 1:39 pm

Re: Debugging LIBXSLT

Post by Crispness »

two things here:

1. You are saying that libxslt cannot be used within the debugger? Is that correct?

2. I am not getting any errors in Oxygen currently with this stylesheet. The 'errors' only show up using libxslt. And I can't use libxslt in Oxygen, can I?

The stylesheet behaves itself perfectly under Saxon.

Is there a way to test the file using libxslt?
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Debugging LIBXSLT

Post by adrian »

The stack size adjustments I mentioned were only necessary for Saxon.
1. You are saying that libxslt cannot be used within the debugger? Is that correct?
1. Yes, that's correct. The Oxygen XSLT debugger supports only the mentioned engines.
Note that Oxygen still supports other(external) processors for XSLT transformations, just not for XSLT debugging.
2. I am not getting any errors in Oxygen currently with this stylesheet. The 'errors' only show up using libxslt. And I can't use libxslt in Oxygen, can I?
2. You can use XSLTProc(the command line tool that uses libxslt) in Oxygen but only for regular transformations, not in the debugger.
You can create an XML/XSLT transformation scenarios(Document -> Transformation -> Configure Transformation Scenario) and choose XSLTProc as the Transformer.

You can find and adjust the Oxygen options for XSLTProc in Options -> Preferences -> XML -> XSLT-FO-XQuery -> XSLT -> XSLTProc

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply