Preventing the insertion of default DTD attributes

Here should go questions about transforming XML with XSLT and FOP.
Mario
Posts: 7
Joined: Wed Jul 26, 2023 7:45 pm

Preventing the insertion of default DTD attributes

Post 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.
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: Preventing the insertion of default DTD attributes

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Mario
Posts: 7
Joined: Wed Jul 26, 2023 7:45 pm

Re: Preventing the insertion of default DTD attributes

Post 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.
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: Preventing the insertion of default DTD attributes

Post by Radu »

Hi,
Looks like a problem with your <xsl:output> method value, value not supported by Saxon 12.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Mario
Posts: 7
Joined: Wed Jul 26, 2023 7:45 pm

Re: Preventing the insertion of default DTD attributes

Post 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?
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: Preventing the insertion of default DTD attributes

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Mario
Posts: 7
Joined: Wed Jul 26, 2023 7:45 pm

Re: Preventing the insertion of default DTD attributes

Post 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);
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: Preventing the insertion of default DTD attributes

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply