Page 1 of 1

Preventing the insertion of default DTD attributes

Posted: Tue Feb 11, 2025 7:24 pm
by Mario
Hello,
Some time back, I created a javascript plugin that uses the Saxon 6 parser to convert from one for of XML to another.
We recently discovered that this is inserting unwanted default attributes.
Is there a way to suppress this? I found the setting for HE/SE/PE, but not for 6.

Re: Preventing the insertion of default DTD attributes

Posted: Wed Feb 12, 2025 8:49 am
by Radu
Hi,
Saxon 6 is a no longer maintained XSLT processor, if its documentation does not contain details about not expanding attribute values then that's that, there may be some XSLT user lists somewhere, I think Michael Kay the developer of both Saxon 6 and 12 is active on Stack overflow if you want to ask there and get an answer from him.
Other than that why not use Saxon HE or remove the DOCTYPE declaration from the XML before processing and then add it back afterwards?
Regards,
Radu

Re: Preventing the insertion of default DTD attributes

Posted: Wed Feb 12, 2025 3:38 pm
by Mario
I tried changing the transformer, and my test didn't work. I see an error of this form:

Engine name: Saxon-PE 12.5
Severity: error
Problem ID: SXCH0004
Description: Cannot create user-supplied output method. Failed to load required class
URL: http://www.saxonica.com/html/documentat ... l#SXCH0004

But I have been unable to determine what that means.

Re: Preventing the insertion of default DTD attributes

Posted: Wed Feb 12, 2025 4:54 pm
by Radu
Hi,
Looks like a problem with your <xsl:output> method value, value not supported by Saxon 12.
Regards,
Radu

Re: Preventing the insertion of default DTD attributes

Posted: Wed Feb 12, 2025 6:08 pm
by Mario
This is the existing one:
<xsl:output method="xsl:xhtml" encoding="UTF-8" indent="no" omit-xml-declaration="no"/>

It looks fine to me?

Re: Preventing the insertion of default DTD attributes

Posted: Thu Feb 13, 2025 7:49 am
by Radu
Hi,
Maybe you can pick a supported xsl:output method value from the Saxon 12 documentation:
https://www.saxonica.com/html/documenta ... utput.html
Regards,
Radu

Re: Preventing the insertion of default DTD attributes

Posted: Thu Feb 13, 2025 8:46 pm
by Mario
Radu wrote: Thu Feb 13, 2025 7:49 am Hi,
Maybe you can pick a supported xsl:output method value from the Saxon 12 documentation:
https://www.saxonica.com/html/documenta ... utput.html
Regards,
Radu
Changing it to xml worked, but now the JavaScript plugin doesn't like the TRANSFORMER_SAXON_ENTERPRISE_EDITION value.

Has the API changed?

Code: Select all

var transformer = pluginWorkspaceAccess.getXMLUtilAccess().createXSLTTransformer(
	new Packages.javax.xml.transform.stream.StreamSource(jsDirURL + "/generalize.xsl"),
	null,
	Packages.ro.sync.exml.workspace.api.util.XMLUtilAccess.TRANSFORMER_SAXON_ENTERPRISE_EDITION, true);

Re: Preventing the insertion of default DTD attributes

Posted: Fri Feb 14, 2025 8:57 am
by Radu
Hi Mario,

It would help if you could post the exact error you get.
The Javadoc of the Enterprise edition constant says something like:

Code: Select all

  /**
   * Saxon 9 Enterprise Edition transformer type (full extensions support + schema aware).<br>
   * 
   * @deprecated Since Oxygen 23 you can no longer create Saxon 9 PE transformers using this constant.
   * The created transformer will be a Saxon HE transformer instead.
   */
  @Deprecated
  @SuppressWarnings("java:S1133")
  final int TRANSFORMER_SAXON_ENTERPRISE_EDITION = 4;
So please use in the JS code "Packages.ro.sync.exml.workspace.api.util.XMLUtilAccess.TRANSFORMER_SAXON_HOME_EDITION" instead.

Regards,
Radu