Page 1 of 1

XSLT Debugger Messages View

Posted: Sat Jan 02, 2021 11:04 pm
by Fiona Chen
Hello, I need to debug my XSL program.

When I turn on the Oxygen debugging sessions, the Messages View doesn't display any message. Below is a example.
image.png
image.png (121.92 KiB) Viewed 854 times
Did I miss anything?

Re: XSLT Debugger Messages View

Posted: Mon Jan 04, 2021 2:55 pm
by tavy
Hello,

From what I tested, with <oXygen/> XML Editor 23.0, build 2020111805, the debugging works fine for me.
What version of Oxygen XML do you use?
Can you send me also the XML document used in the debugging process, or a sample on which you reproduce the problem?
What engine do you use for debugging?

Best Regards,
Octavian

Re: XSLT Debugger Messages View

Posted: Mon Jan 04, 2021 10:33 pm
by Fiona Chen
Hello, Octavian:

<oXygen/> XML Editor 23.0, build 2020121712

A very simple XSL:

Code: Select all

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    version="2.0">
    
    <xsl:template match="/">
        <xsl:message>Test Message</xsl:message>
    </xsl:template>
</xsl:stylesheet>
A very simple XML:

Code: Select all

<source>
    <chapter>Chapter A</chapter>
    <chapter>Chapter B</chapter>
    <chapter>Chapter C</chapter>
    <chapter>Chapter D</chapter>
</source>
XSLT Debugger Perspective -> Messages -> Blank Screen

Re: XSLT Debugger Messages View

Posted: Mon Jan 04, 2021 10:45 pm
by Fiona Chen
My goal is to use XSLT3.0

Code: Select all

xsl:assert
|

Code: Select all

xsl:try & catch
:
  • Strictly validate the transformation results: the transformation involves large amount of data movement and complex calculation
  • Should any of the transformed element count or value doesn't match, the module throws the exception and terminates the program immediately. It is similar to the application of Java | C# exception throwing
I can't get the

Code: Select all

assert | try/catch
work in Oxygen. Either case throws blank screen.

Re: XSLT Debugger Messages View

Posted: Wed Jan 06, 2021 4:21 pm
by tavy
Hello,

Unfortunately I cannot reproduce the problem. I tested with the same version that you used <oXygen/> XML Editor 23.0, build 2020121712. I used Saxon HE 9.9.1.7 for debugging with the default options, and I get the test message in the Messages view.
What engine do you use for debugging? Maybe you have some options set for the processor. Do you use a Saxon configuration file?

debug.png
debug.png (65.59 KiB) Viewed 810 times

The "try/catch" works fine in Oxygen from what I tested. For the "xsl:assert" instruction you need to enable the assertions from the Saxon-PE/EE Options. For this you need to use Saxon-PE or EE, and check the Enable assertions ("-ea") from the Advanced Saxon XSLT Transformation Options. If you run the transformation from Debugger, you can change this option from XSLT / XQuery engine advanced options toolbar button:
https://www.oxygenxml.com/doc/versions/ ... olbar.html
If you are using a transformation scenario set the option from the advance options:
https://www.oxygenxml.com/doc/versions/ ... ed-options

You can find more details about Saxon options in our user manual:
https://www.oxygenxml.com/doc/versions/ ... ee_options

Re: XSLT Debugger Messages View

Posted: Thu Jan 07, 2021 1:53 am
by Fiona Chen
Hello, Octavian:

I deleted the Oxygen & plugin Options & Project state related files in the FS.
Miraculously, it produced the expected message in the simple template...Eh
image.png
image.png (154.75 KiB) Viewed 792 times
(Notice: The UI is different from my previous image after the cleanup. )

The processor is ALWAYS the same:
image.png
image.png (79.52 KiB) Viewed 792 times
However, the system can't emit the message when the template is complex.
Not sure if it is because :
I use ${currentFileURL} as XML URL in the transformation scenario. Notice the debugger perspective doesn't display input XML if you use ${currentFileURL}.

Can you test this:
create a template using source-document, use ${currentFileURL} as XML URL , and then execute it in Debugger perspective.

Code: Select all

<xsl:template match="/">
        <xsl:message>TEST MESSAGE</xsl:message>
        <xsl:source-document href="foo.xml">
             <xsl:apply-templates select="foo-sth" mode="val"/>
        </xsl:source-document>
    </xsl:template>
And please let me know if your Oxygen can emit the message or not?

Thank you!!

Re: XSLT Debugger Messages View

Posted: Thu Jan 07, 2021 5:00 am
by Fiona Chen
My latest discovery is that the presence of the input XML coincides with the presence of the xsl:message:
If I open the input XML on the screen then edit/start a debug session, the system returns the xsl:message.

I will let you know if I encounter issue with xsl:assert and try/catch.

Thank you !!

Re: XSLT Debugger Messages View

Posted: Fri Jan 08, 2021 1:35 pm
by tavy
Hello,

From what I tested the message is presented also when the ${currentFileURL} is used as XML URL.
If you create a transformation scenario for an XSL and you use the ${currentFileURL} for both XML URL and XSL URL, the ${currentFileURL} editor variable will be expended to the location of the XSL. Therefore, the XSL will be used also as XML input. Because in your template example you match just the root and display a message, the template message should be presented correctly.
image.png
image.png (68.6 KiB) Viewed 772 times

Re: XSLT Debugger Messages View

Posted: Wed Jan 13, 2021 10:27 pm
by Fiona Chen
Interesting Point...

Scenario One:
Saxon EE -> Enable streaming mode -> Debug -> no message
image.png
image.png (210.67 KiB) Viewed 692 times

Scenario Two:
Saxon EE -> Disable streaming mode -> Debug -> xsl:message
Saxon HE | PE works as well
image.png
image.png (212.73 KiB) Viewed 692 times
Please let me know if you see different results based on above two scenarios from your end!
Is this Oxygen's incompatibility with Streaming or did I misinterpret the functionality of Oxygen/Saxon?

Re: XSLT Debugger Messages View

Posted: Thu Jan 14, 2021 3:04 pm
by tavy
Hello,

Thanks for your feedback.

Yes, it seems that when Saxon is in streaming mode the xsl:message is not presented in the Messages view. The message is presented in the console view, if open you have opened Oxygen from a console you will see the message there.
I added an issue on our issue tracker to investigate this problem. I will update this thread when I have a conclusion.

Re: XSLT Debugger Messages View

Posted: Thu Jan 14, 2021 9:28 pm
by Fiona Chen
Excellent!

Below should be the aligned output in Oxygen/SaxonEE with Streaming mode.

On-success message:
SaxEE-editor-onsuccessprint-message.jpg
SaxEE-editor-onsuccessprint-message.jpg (54.57 KiB) Viewed 669 times
On-failure message:
SaxEE-editor-onfailure-message.jpg
SaxEE-editor-onfailure-message.jpg (52.58 KiB) Viewed 669 times
On-termination exception:
SaxEE-editor-onterminate.jpg
SaxEE-editor-onterminate.jpg (71.4 KiB) Viewed 669 times
This is the preliminary validation.
Notice that the system is in Editor perspective not Debug. It gives the clarity as if the validation is actually acted out exactly as instructed.

I am reviewing different solutions of comprehensive validation and exception throwing.