How to trace a transformation process in the XSLT Debugger
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 58
- Joined: Fri Sep 12, 2008 12:12 am
How to trace a transformation process in the XSLT Debugger
I have used Oxygen's handy XSLT debugger before but I have been hard pressed to figure out how to apply it to the entire series of transformations performed in, say, a PDF transform since the debugger wants just one XML file and one XSL file run together.
I am guessing that for a PDF2 transform (the Idiom Technologies transform) I will need to get/intercept a preprocessed form of a document's XML and then perhaps apply it to what I consider the "boot-strapping" XSL file that starts it all, topic2fo_shell.xsl or topic2fo_shell_1.0.xsl, which will then call root-processing.xsl with the template match:
and then continue to call the other xsl dependancies/files necessary to complete the transformation. Does that sound like it will work?
First of all though I will need to be reminded how to capture an intermediate form of the XML once it is preprocessed, and where I should place the statement to do so (I assume in the topic2fo_shell.xsl file somewhere). I recall that Radu somewhere told me a of a command to echo the XML document line by line into the transformation window at the bottom of Oxygen, which can then be copied into a file and saved as XML.
As for the rest of the process though, if I wanted to see the entire transformation process, like which XSL files call other XSL files, etc then which XSL file do I need to apply the XML to in order to view the full trace?
Thanks,
~Josh
I am guessing that for a PDF2 transform (the Idiom Technologies transform) I will need to get/intercept a preprocessed form of a document's XML and then perhaps apply it to what I consider the "boot-strapping" XSL file that starts it all, topic2fo_shell.xsl or topic2fo_shell_1.0.xsl, which will then call root-processing.xsl with the template match:
Code: Select all
<xsl:template match="/">
<xsl:call-template name="rootTemplate"/>
</xsl:template>
First of all though I will need to be reminded how to capture an intermediate form of the XML once it is preprocessed, and where I should place the statement to do so (I assume in the topic2fo_shell.xsl file somewhere). I recall that Radu somewhere told me a of a command to echo the XML document line by line into the transformation window at the bottom of Oxygen, which can then be copied into a file and saved as XML.
As for the rest of the process though, if I wanted to see the entire transformation process, like which XSL files call other XSL files, etc then which XSL file do I need to apply the XML to in order to view the full trace?
Thanks,
~Josh
-
- Posts: 58
- Joined: Fri Sep 12, 2008 12:12 am
Re: How to trace a transformation process in the XSLT Debugger
I am specifically trying to trace a PDF2 transformation with the files in the OXYGEN_INSTALL_DIR\dita\DITA-OT\demo\fo\ directory and its subdirectories, if I did not make that clear to begin with. Knowing how the process works in general though would be useful so that I could also apply it to other transformations like HTML.
Josh
Josh
-
- Posts: 9439
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to trace a transformation process in the XSLT Debugger
Hi Josh,
First you should transform your map to PDF using the DITA Open Toolkit IDIOM transformation.
Then, you should open in Oxygen from the temporary directory a file called stage1.xml.
Then debug this XML against the topic2fo_shell.xsl file.
This should be somewhat equivalent to the stage which generates FO from the XML.
Basically this stage takes place in the transform.topic2fo target from the OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\demo\fo\build.xml
Regards,
Radu
First you should transform your map to PDF using the DITA Open Toolkit IDIOM transformation.
Then, you should open in Oxygen from the temporary directory a file called stage1.xml.
Then debug this XML against the topic2fo_shell.xsl file.
This should be somewhat equivalent to the stage which generates FO from the XML.
Basically this stage takes place in the transform.topic2fo target from the OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\demo\fo\build.xml
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 58
- Joined: Fri Sep 12, 2008 12:12 am
Re: How to trace a transformation process in the XSLT Debugger
Great, that is quite convenient that they give the xml to you. I'm not sure if the legacy PDF did that but that beats having to modify the code to echo it to the output window and then copy it. Thank you.
However now that I've tried it in the XSLT Debugger topic2fo_shell.xsl fails immediatey once you run the debugger. I copied the two error messages that appear in Oxygen's results window:
Any ideas?
However now that I've tried it in the XSLT Debugger topic2fo_shell.xsl fails immediatey once you run the debugger. I copied the two error messages that appear in Oxygen's results window:
So then I tried running stage1.xml against topic2fo_shell_1.0.xsl instead and it does a little bit better in that it echoes messages I've set in my xsl files to notify me where in the file it is, but it never completes the transformation, it cannot show a profiling invocation tree, and it spits out dozens of messages that report the same error (shown below):SystemID: C:\Program Files\Oxygen XML Editor 10\frameworks\dita\DITA-OT\demo\fo\xsl\fo\topic2fo_shell.xsl
Severity: error
Description: Failed to compile stylesheet. 1 error detected.
SystemID: C:\Program Files\Oxygen XML Editor 10\frameworks\dita\DITA-OT\demo\fo\xsl\fo\topic2fo_shell.xsl
Severity: warning
Description: Malformed URL cfg:fo/attrs/custom.xsl(base file:/C:/Program%20Files/Oxygen%20XML%20Editor%2010/frameworks/dita/DITA-OT/demo/fo/xsl/fo/topic2fo_shell.xsl) - unknown protocol: cfg
Start location: 66:0
Obviously the problem here is that it is looking for a file called vars/.xml which isn't going to work with that forward slash in the middle of it, but I have no idea what is producing that error.Severity: warning
Description: Failure reading file:/common/vars/.xml - C:\common\vars\.xml (The system cannot find the path specified)
Severity: warning
Description: Failure reading file:/C:/Program%20Files/Oxygen%20XML%20Editor%2010/frameworks/dita/DITA-OT/demo/fo/cfg/common/vars/.xml - C:\Program Files\Oxygen XML Editor 10\frameworks\dita\DITA-OT\demo\fo\cfg\common\vars\.xml (The system cannot find the file specified)
Any ideas?
-
- Posts: 58
- Joined: Fri Sep 12, 2008 12:12 am
Re: How to trace a transformation process in the XSLT Debugger
As it turns out the second set of errors I mentioned were just warnings that a custom variable had not been set. When the "insertVariable" template is invoked on line 70 of vars.xsl it sets a variable on line 74 with the assignment:
Which apparently produces a warning. I guess if $locale is not defined you get no file name and thus get a warning.
So moving beyond that I looked at the very bottom and what stops the trace when running stage1.xml with topic2fo_shell_1.0.xsl is a similar error to what I saw before:
Code: Select all
<xsl:variable name="customizationFilePath" select="concat($fileProtocolPrefix, $customizationDir, '/common/vars/', $locale, '.xml')"/>
So moving beyond that I looked at the very bottom and what stops the trace when running stage1.xml with topic2fo_shell_1.0.xsl is a similar error to what I saw before:
Same unknown protocol error for 'cfg'. I'm still not sure what's up with this.Severity: warning
Description: Malformed URL cfg:fo/attrs/custom.xsl(base file:/C:/Program%20Files/Oxygen%20XML%20Editor%2010/frameworks/dita/DITA-OT/demo/fo/xsl/common/attr-set-reflection.xsl) - unknown protocol: cfg
-
- Posts: 58
- Joined: Fri Sep 12, 2008 12:12 am
Re: How to trace a transformation process in the XSLT Debugger
Perhaps that is only an insignificant warning also. I've been able to do most of what I wanted already by being able to step through topic2fo_shell_1.0.xsl manually, but the only issue is that when I turn profiling on it will not show an invocation tree.
-
- Posts: 9439
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to trace a transformation process in the XSLT Debugger
Hi Josh,
First for the profiler: it only shows the results when the debugging session has finished.
As for the "cfg:" errors, there are some XSLT stylsheeets referencing other stylesheets by this protocol like:
I see there is a catalog file in OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\demo\fo\cfg\catalog.xml which maps the "cfg:" paths to real paths.
I think you should add this catalog to the Oxygen catalogs list, restart and the debugger should use this catalog to resolve references.
Regards,
Radu
First for the profiler: it only shows the results when the debugging session has finished.
As for the "cfg:" errors, there are some XSLT stylsheeets referencing other stylesheets by this protocol like:
Code: Select all
document('cfg:fo/attrs/custom.xsl')
I think you should add this catalog to the Oxygen catalogs list, restart and the debugger should use this catalog to resolve references.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9439
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to trace a transformation process in the XSLT Debugger
About the locale not being set:
In the build.xml file there are some arguments given to the XSLT transformation:
You should add some <echo>'s in the build file to get the values for the parameters and then in Oxygen in the debugging mode you have a "Configure parameters" toolbar button and you can add the parameters there.
Regards,
Radu
In the build.xml file there are some arguments given to the XSLT transformation:
Code: Select all
<arg line='"locale=${document.locale}"'/>
<arg line='"customizationDir=${customization.dir}"'/>
<arg line='"artworkPrefix=${artworkPrefixUrl}"'/>
<arg line='"fileProtocolPrefix=${file.protocol.prefix}"'/>
<arg line='"publishRequiredCleanup=${publish.required.cleanup}"'/>
<arg line='"disableRelatedLinks=${disableRelatedLinks}"'/>
<arg line='"pdfFormatter=${pdf.formatter}"'/>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 58
- Joined: Fri Sep 12, 2008 12:12 am
Re: How to trace a transformation process in the XSLT Debugger
Hello Radu,
Thanks for the pointers on the cfg calls and $locale. I figured that since the build.xml file was not being used that it was not passing in needed parameters. I suppose though that those are unrelated to the profiling problem.
Regards,
Josh
Thanks for the pointers on the cfg calls and $locale. I figured that since the build.xml file was not being used that it was not passing in needed parameters. I suppose though that those are unrelated to the profiling problem.
So what exactly does that mean? Despite those warnings about the parameters not being there, after I run stage1.xml against the XSL transformation file it says at the top "Debug execution finished" and I can see the processed output in the far right pane, yet the Invocation Tree tab remains blank. During the transform it does indeed say "Collecting Data..." but once it completes that message goes away and the tab remains blank. Maybe I need to enable something? Profiling is obviously turned on, otherwise you will not see the Invocation Tree tab.First for the profiler: it only shows the results when the debugging session has finished.
Regards,
Josh
-
- Posts: 9439
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to trace a transformation process in the XSLT Debugger
Hi Josh,
Probably the debuggin session does not finish succesful.
After the debugging is finished, do you get any kind of error in the Oxygen "Debugger" errors tab?
Any warning?
Regards,
Radu
Probably the debuggin session does not finish succesful.
After the debugging is finished, do you get any kind of error in the Oxygen "Debugger" errors tab?
Any warning?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 58
- Joined: Fri Sep 12, 2008 12:12 am
Re: How to trace a transformation process in the XSLT Debugger
Hi Radu,
The only errors were the two I've already mentioned about "locale" and "cfg". I added the catalog.xml to the catalog settings like you suggested, and I manually configured the parameter for the locale to be set to en_US, which cuts the locale errors in half. The only remaining error is this (236 times):
No such directory under C: even exists on my computer. I'm not really sure if this singular error would prevent the profilier from operating correctly though. /common/vars/ is a relative path, and before I added the en_US parameter the errors would come in pairs: 1) that it could not find it at C:\common\vars (like here) and 2) the other was that it couldn't find it in C:\Program Files\Oxygen XML Editor 10\frameworks\dita\DITA-OT\demo\fo\cfg\common\vars, but that was because it couldn't find a file named " .xml" because it had no file name prefix. When I added en_US to the parameters the second error went away, but the first still remains.
~Josh
The only errors were the two I've already mentioned about "locale" and "cfg". I added the catalog.xml to the catalog settings like you suggested, and I manually configured the parameter for the locale to be set to en_US, which cuts the locale errors in half. The only remaining error is this (236 times):
Severity: warning
Description: Failure reading file:/common/vars/en_US.xml - C:\common\vars\en_US.xml (The system cannot find the path specified)
No such directory under C: even exists on my computer. I'm not really sure if this singular error would prevent the profilier from operating correctly though. /common/vars/ is a relative path, and before I added the en_US parameter the errors would come in pairs: 1) that it could not find it at C:\common\vars (like here) and 2) the other was that it couldn't find it in C:\Program Files\Oxygen XML Editor 10\frameworks\dita\DITA-OT\demo\fo\cfg\common\vars, but that was because it couldn't find a file named " .xml" because it had no file name prefix. When I added en_US to the parameters the second error went away, but the first still remains.
~Josh
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: How to trace a transformation process in the XSLT Debugger
Post by sorin_ristache »
Hello,
Regards,
Sorin
Did you set the parameters fileProtocolPrefix and customizationDir? The parameters are used in the file path for the file from the relative directory common/vars/. You can see the values for the parameters in the console output of a transformation of type PDF - Idiom FO Plugin that you run from the DITA Maps Manager view as Radu specified.jnielsen wrote:/common/vars/ is a relative path, and before I added the en_US parameter the errors would come in pairs: 1) that it could not find it at C:\common\vars (like here)
...
the second error went away, but the first still remains.
Regards,
Sorin
-
- Posts: 58
- Joined: Fri Sep 12, 2008 12:12 am
Re: How to trace a transformation process in the XSLT Debugger
Sorry I never replied to this. No I did not specify all the parameters. I'm sure I can figure it out from here though. Thanks for all your help.sorin wrote:Hello,
Did you set the parameters fileProtocolPrefix and customizationDir? The parameters are used in the file path for the file from the relative directory common/vars/. You can see the values for the parameters in the console output of a transformation of type PDF - Idiom FO Plugin that you run from the DITA Maps Manager view as Radu specified.
Regards,
Sorin
Regards,
Josh
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service