Project

Profile

Help

Bug #5553

closed

SaxonCS - when running from command line, xsl:message output goes nowhere

Added by Michael Kay over 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2022-05-31
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, trunk
Fix Committed on Branch:
11, trunk
Fixed in Maintenance Release:
Platforms:
.NET

Description

See https://saxonica.plan.io/boards/3/topics/8755?pn=1

xsl:message output from a command line transformation in SaxonCS simply disappears.


Related issues

Has duplicate Saxon - Bug #5648: SaxonCS with command line -ea:on triggers xs:assert but doesn't output the message insideDuplicate2022-08-17

Actions
Actions #1

Updated by Michael Kay over 2 years ago

The problem seem to be with class LoggingWriter, which attempt to bridge the "Writer" interface to the Saxon Logger.

The LoggingWriter is Java code that overrides java.io.Writer. The transpiler simply converts this to a corresponding C# class that overrides System.IO.TextWriter. The problem is, although the Java and C# interfaces are very similar (otherwise this wouldn't be possible), the methods that a subclass has to implement appear to be different in the two cases. It looks like the output is being written to an interface that we haven't implemented, causing it to disappear.

Actions #2

Updated by Michael Kay over 2 years ago

Specifically, The C# TextWriter says:

A derived class must minimally implement the Write(Char) method to make a useful instance of TextWriter.

while Java Writer says

The only methods that a subclass must implement are write(char[], int, int), flush(), and close()

Actions #3

Updated by Michael Kay over 2 years ago

  • Status changed from New to In Progress

Fixed by re-implementing the LoggingWriter class in hand-coded C# as Saxon.Impl.Overrides.LoggingWriter.

Actions #4

Updated by Michael Kay over 2 years ago

  • Status changed from In Progress to Resolved
  • Fix Committed on Branch 11, trunk added
Actions #5

Updated by Debbie Lockett over 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 11.4 added

Bug fix applied in the Saxon 11.4 maintenance release.

Actions #6

Updated by Martin Honnen over 2 years ago

For me, at least on Windows, I don't see any fix:

SaxonCS:

PS C:\Users\marti\SomePath\saxoncs-message-test> & 'C:\Program Files\Saxonica\SaxonCS-11.4\SaxonCS.exe' transform -it -xsl:.\sheet1.xsl
<?xml version="1.0" encoding="UTF-8"?><test>Run with SAXON EE 11.4 </test><!--Run with SAXON EE 11.4 -->

Saxon HE Java:

PS C:\Users\marti\SomePath\saxoncs-message-test> java -jar 'C:\Program Files\Saxonica\SaxonHE11-4J\saxon-he-11.4.jar' -it -xsl:.\sheet1.xsl
Run with SAXON HE 11.4
<?xml version="1.0" encoding="UTF-8"?><test>Run with SAXON HE 11.4 </test><!--Run with SAXON HE 11.4 -->

Code

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="3.0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  exclude-result-prefixes="#all"
  expand-text="yes">

  <xsl:template match="/" name="xsl:initial-template">
    <test>Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('Q{http://saxon.sf.net/}platform')}</test>     
    <xsl:comment>Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('Q{http://saxon.sf.net/}platform')}</xsl:comment>
    <xsl:message>Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('Q{http://saxon.sf.net/}platform')}</xsl:message>
  </xsl:template>
  
</xsl:stylesheet>
Actions #7

Updated by Michael Kay over 2 years ago

  • Status changed from Closed to In Progress

It seems that as a result of some kind of build error the corrected LoggingWriter is not being used, and the old one (transpiled from the Java version) is still invoked.

Actions #8

Updated by Michael Kay over 2 years ago

  • Status changed from In Progress to Resolved

I suspect I made changes locally to the C# code to test the fix, and then failed to apply the corresponding fix to the Java source to make it persist.

Actions #9

Updated by Michael Kay about 2 years ago

  • Has duplicate Bug #5648: SaxonCS with command line -ea:on triggers xs:assert but doesn't output the message inside added
Actions #10

Updated by O'Neil Delpratt almost 2 years ago

  • Fixed in Maintenance Release 12.0 added
  • Fixed in Maintenance Release deleted (11.4)

Bug issue fix applied in the Saxon 12.0 Major Release. Leaving this bug marked as Resolved until fix applied to Saxon 11 branch.

Actions #11

Updated by O'Neil Delpratt almost 2 years ago

  • Fixed in Maintenance Release 11.5 added

Bug applied in the Saxon 11.5 Maintenance release.

Actions #12

Updated by O'Neil Delpratt almost 2 years ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF