Topics

Debugging XSLT transforms with Visual Studio Code #DITA-OT #XSLT

nyxys21@...
 

Hi dita-users,

I was wondering if there is a way to use Visual Studio Code (or something similar) to debug DITA-OT plugins.

I'm fairly new to DITA and DITA-OT. I've been debugging plugins up to now mostly through trial and error. I make an update to the plugin then use FrameMaker to Generate DITA-OT Output. If it doesn't look correct I make an update and then make a PDF again.

I saw that Visual Studio Code has an xslt transform debugger. Is there a way to use that to debug DITA-OT? What method do you use to debug plugins?

Kristen James Eberlein
 

I use oXygen XML Editor for all my work:

  • Authoring DITA content
  • Building DITA-OT plug-ins
  • Developing and debugging XSLT and Schematron

oXygen XML Editor has perspectives designed specifically to help you debug XSLT and XQuery transformations. Here is a link to a topic in the documentation: https://www.oxygenxml.com/doc/versions/21.1/ug-editor/topics/debugging.html

The topic contains a link to a four-minutes video.

Best,
Kris

Kristen James Eberlein
Chair, OASIS DITA Technical Committee
Principal consultant, Eberlein Consulting
www.eberleinconsulting.com
+1 919 622-1501; kriseberlein (skype)

On 12/10/2019 2:39 PM, nyxys21@... wrote:
Hi dita-users,

I was wondering if there is a way to use Visual Studio Code (or something similar) to debug DITA-OT plugins.

I'm fairly new to DITA and DITA-OT. I've been debugging plugins up to now mostly through trial and error. I make an update to the plugin then use FrameMaker to Generate DITA-OT Output. If it doesn't look correct I make an update and then make a PDF again.

I saw that Visual Studio Code has an xslt transform debugger. Is there a way to use that to debug DITA-OT? What method do you use to debug plugins?

Mark Giffin
 

I have not used the VS Code xslt debugger. You would need to determine which XSLT from the OT was being run on what XML file, and then probably run the xslt on the xml file separately, outside the OT. For general info on what's involved in something like this, see this Oxygen topic:

https://www.oxygenxml.com/doc/versions/21.1/ug-editor/topics/debugging-pdf-transformation.html

That topic is for using Oxygen's xslt debugger, and it's for PDF output, but it gives some background on what you would need to do to get the right XSLT and XML files. For example you probably need to save the temp directory created by the OT, because most of the XSLT in the OT runs on temp files that have been processed by the OT and are different from the pristine source DITA files.

Also, in looking at info on the VS Code XSLT debugger, it's hard to see what version of XSLT it supports:

https://docs.microsoft.com/en-us/visualstudio/xml-tools/debugging-xslt?view=vs-2019

A lot of XSLT tools only support XSLT version 1. Late model versions of the OT use XSLT 2, and they may even be doing stuff with XSLT 3 (not sure about that). And the MS link above looks like it's using the XSLT processor that comes with .NET. The OT uses the Saxon XSLT processor, which is Java-based.

VS Code is a really nice code editor, but I doubt it knows anything about the DITA OT. The OT is basically an Apache Ant application that calls Java code and XSLT code. I don't know of a debugger that traces what the OT itself is doing. And I know of no "OT plugin debugger".

There are many, many things that an OT plugin can do. If you are simply doing PDF output, that cuts down the factors a lot. If you are doing PDF output development, and you are running the output over and over again, you can cut down your source files to get the shortest possible build times. You might run the OT from the command line to speed things up.

Also, if you are using Framemaker for PDF, why aren't you using the Fm PDF capability? Just curious.

Mark Giffin
Mark Giffin Consulting, Inc.
http://markgiffin.com/


On 12/10/2019 11:39 AM, nyxys21@... wrote:
Hi dita-users,

I was wondering if there is a way to use Visual Studio Code (or something similar) to debug DITA-OT plugins.

I'm fairly new to DITA and DITA-OT. I've been debugging plugins up to now mostly through trial and error. I make an update to the plugin then use FrameMaker to Generate DITA-OT Output. If it doesn't look correct I make an update and then make a PDF again.

I saw that Visual Studio Code has an xslt transform debugger. Is there a way to use that to debug DITA-OT? What method do you use to debug plugins?

ekimber@contrext.com
 

Re XSLT 2 vs XSLT in Open Toolkit: Recent versions of Saxon, including the versions in OT 2.5.4 and 3.x, support XSLT 3 and basically treat all style sheets as XSLT 3, meaning that you can mix XSLT modules that declare themselves to be XSLT 2 with modules that declare themselves to be XSLT 3.

This means, for example, that any OT extension's XSLT could be XSLT 3 even though the base OT transforms being extended are still XSLT 2. There is no need to update all your XSLT modules to declare themselves to be XSLT 3 just so you can use XSLT 3 in some modules. On the other hand, changing version="2.0" to version="3.0" should have no effect on the existing code, but it will allow you to use XSLT 3 features like text value templates, mode-specific default behaviors, xsl:iterate, maps and arrays, and other very handy features in XSLT 3 and XPath 3.1.

Cheers,

E.

--
Eliot Kimber
http://contrext.com


On 12/12/19, 3:05 PM, "Mark Giffin" <dita-users@groups.io on behalf of mark@...> wrote:






I have not used the VS Code xslt debugger. You would need to
determine which XSLT from the OT was being run on what XML file, and
then probably run the xslt on the xml file separately, outside the
OT. For general info on what's involved in something like this, see
this Oxygen topic:

https://www.oxygenxml.com/doc/versions/21.1/ug-editor/topics/debugging-pdf-transformation.html


That topic is for using Oxygen's xslt debugger, and it's for PDF
output, but it gives some background on what you would need to do to
get the right XSLT and XML files. For example you probably need to
save the temp directory created by the OT, because most of the XSLT
in the OT runs on temp files that have been processed by the OT and
are different from the pristine source DITA files.

Also, in looking at info on the VS Code XSLT debugger, it's hard to
see what version of XSLT it supports:

https://docs.microsoft.com/en-us/visualstudio/xml-tools/debugging-xslt?view=vs-2019

A lot of XSLT tools only support XSLT version 1. Late model versions
of the OT use XSLT 2, and they may even be doing stuff with XSLT 3
(not sure about that). And the MS link above looks like it's using
the XSLT processor that comes with .NET. The OT uses the Saxon XSLT
processor, which is Java-based.

VS Code is a really nice code editor, but I doubt it knows anything
about the DITA OT. The OT is basically an Apache Ant application
that calls Java code and XSLT code. I don't know of a debugger that
traces what the OT itself is doing. And I know of no "OT plugin
debugger".

There are many, many things that an OT plugin can do. If you are
simply doing PDF output, that cuts down the factors a lot. If you
are doing PDF output development, and you are running the output
over and over again, you can cut down your source files to get the
shortest possible build times. You might run the OT from the command
line to speed things up.

Also, if you are using Framemaker for PDF, why aren't you using the
Fm PDF capability? Just curious.

Mark Giffin
Mark Giffin Consulting, Inc.
http://markgiffin.com/

On 12/10/2019 11:39 AM,
nyxys21@... wrote:



Hi dita-users,

I was wondering if there is a way to use Visual Studio Code (or
something similar) to debug DITA-OT plugins.

I'm fairly new to DITA and DITA-OT. I've been debugging plugins up
to now mostly through trial and error. I make an update to the
plugin then use FrameMaker to Generate DITA-OT Output. If it
doesn't look correct I make an update and then make a PDF again.

I saw that Visual Studio Code has an xslt transform debugger. Is
there a way to use that to debug DITA-OT? What method do you use
to debug plugins?

nyxys21@...
 

Thanks for the info Mark. It doesn't look like Visual Studio is a good option for debugging DITA-OT. I saw the XSLT debugger and thought there might be a way to get it to work. 

I am just doing PDF output for now. The company I work for is going to be using a CCMS and I would like to have the DITA-OT plugins ready to go.

Isn't the Save As PDF in FrameMaker more for unstructured or structured FrameMaker files? It doesn't seem like a good option for saving DITA files as PDF.

Mark Giffin
 

You can do a lot with Framemaker and PDF, even if it's structured Framemaker. But if you want to automate the PDF configuration you have made, I believe you need to use something called Framemaker Server. Last I checked, Framemaker Server was about $8000. I'm not sure if your CCMS would support it easily. I think the new Adobe DITA CCMS (an add-on to Adobe Experience Manager) supports Fm Server.

But most likely, in my opinion, the DITA OT is the best way to go. Every DITA CCMS I know of supports it.

Mark

On 12/17/2019 2:55 PM, nyxys21@... wrote:
Thanks for the info Mark. It doesn't look like Visual Studio is a good option for debugging DITA-OT. I saw the XSLT debugger and thought there might be a way to get it to work. 

I am just doing PDF output for now. The company I work for is going to be using a CCMS and I would like to have the DITA-OT plugins ready to go.

Isn't the Save As PDF in FrameMaker more for unstructured or structured FrameMaker files? It doesn't seem like a good option for saving DITA files as PDF.