Default attributes from DTD during XSLT transformation

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
gpm2a
Posts: 22
Joined: Thu Apr 27, 2006 5:39 pm

Default attributes from DTD during XSLT transformation

Post by gpm2a » Mon Oct 18, 2010 4:01 pm

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.

gpm2a
Posts: 22
Joined: Thu Apr 27, 2006 5:39 pm

Re: Default attributes from DTD during XSLT transformation

Post by gpm2a » Mon Oct 18, 2010 4:57 pm

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

adrian
Posts: 2535
Joined: Tue May 17, 2005 4:01 pm

Re: Default attributes from DTD during XSLT transformation

Post by adrian » Wed Oct 02, 2013 11:20 am

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

michaelmh
Posts: 13
Joined: Tue Jan 19, 2016 5:55 pm

Re: Default attributes from DTD during XSLT transformation

Post by michaelmh » Thu Apr 28, 2016 3:36 pm

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!

adrian
Posts: 2535
Joined: Tue May 17, 2005 4:01 pm

Re: Default attributes from DTD during XSLT transformation

Post by adrian » Thu Apr 28, 2016 4:18 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Post Reply