Page 1 of 1

Default attributes from DTD during XSLT transformation

Posted: Mon Oct 18, 2010 4:01 pm
by gpm2a
When an XML document declares the DTD associated with it using the DOCTYPE declaration, I want to be able to transform the document with XSLT (2.0, so I'm using Saxon) in such a way that the DTD is ignored when the document is parsed prior to transformation, because I don't want the default attributes from the DTD coming into play. It's not obvious to me how to do this. In the Oxygen preferences, under XML / XSLT-FO-XQuery / XSLT / Saxon / Saxon-HE/PE/EE, I have already turned off (unchecked) this option: DTD based validation of the source file ("-v"). It seems like that should do the trick, but it doesn't.

Is the XSLT processor required to read the DTD and bring in the default attributes even if validation of source is turned off?

If so, is there a way around this, other than to remove the DOCTYPE declaration altogether?

I suppose this is a Saxon question more than an Oxygen one, but nonetheless I'd appreciate any suggestions.

Re: Default attributes from DTD during XSLT transformation

Posted: Mon Oct 18, 2010 4:57 pm
by gpm2a
Never mind. I figured out that I can do this using a Saxon config file, like so:
  • In the Configure Transformation Scenario dialog, edit your transformation scenario
  • For "Transformer", choose Saxon PE or EE, then click the little gear icon to open the advanced options dialog
  • Check "Use a configuration file" and enter the path to a config file such as this:

Code: Select all


<configuration xmlns="http://saxon.sf.net/ns/configuration" edition="EE">
<global expandAttributeDefaults="false"/>
</configuration>
The config file format is detailed here:
http://www.saxonica.com/documentation/i ... -file.html

Re: Default attributes from DTD during XSLT transformation

Posted: Wed Oct 02, 2013 11:20 am
by adrian
Hi,

Apologies for resurrecting an old thread, I just wanted to mention an alternative solution in case anyone else encounters this.
Starting with Oxygen v14.2 you can easily prevent this by setting an option in the Saxon-HE/PE/EE Advanced options (cogwheel button icon) from the transformation scenario configuration or directly in the XSLT debugger.
Disable the option: Expand attribute defaults ("-expand").

If you want to disable this globally in Oxygen, you can find the same option in: Options > Preferences, XML > XSLT/FO/XQuery > XSLT > Saxon > Saxon HE/PE/EE.

Regards,
Adrian

Re: Default attributes from DTD during XSLT transformation

Posted: Thu Apr 28, 2016 3:36 pm
by michaelmh
We found the expand setting for DTDs, but how about default attributes used in XSD schemas. Is there a way to control their expansion before XSLT transformations?
Thx!

Re: Default attributes from DTD during XSLT transformation

Posted: Thu Apr 28, 2016 4:18 pm
by adrian
Hi,

It's the same option that controls the expansion of default attributes from either DTD or XML schema (XSD).
Note that only Saxon-EE is schema aware. For Saxon-PE/HE this option won't make any difference with XML schema (default attributes will not be expanded).

What version and build of Oxygen are you using (Help > About)?

Regards,
Adrian