Overriding xml-stylesheet PI with framework CSS

Post here questions and problems related to oXygen frameworks/document types.
afuchs
Posts: 15
Joined: Mon May 19, 2014 11:38 am

Overriding xml-stylesheet PI with framework CSS

Post by afuchs » Mon May 19, 2014 11:56 am

Dear Board Members,

Is there a way to make oXygen apply a CSS from a framework despite an xml-stylesheet PI inside the XML document referring to an external CSS file?

I have hundreds of files someone created from a template that included the PI, and would like to exclude the unnecessary complication of an absolute path to an ugly CSS, the necessity of reworking the latter and so on. It is currently not possible to remove the problematic PI from all the files.

Thank you in advance,
AF

Radu
Posts: 6335
Joined: Fri Jul 09, 2004 5:18 pm

Re: Overriding xml-stylesheet PI with framework CSS

Post by Radu » Mon May 19, 2014 12:54 pm

Hi Alexey,

The CSS linked in the document type is considered as having a very high priority.

What you could try would be this:

If you edit your custom document type configuration in the Oxygen Preferences->"Document Type Association" page in the Author->CSS tab you can only decide to ignore the CSS from the document type if the CSS is referenced in the XML document or to merge them together. You could change that setting to Merge.

Then if the XML references to the CSS something like:

Code: Select all

<?xml-stylesheet type="text/css" href="path/to/a.css"?>
you could create an XML catalog catalog.xml in your custom document type's folder which maps from that path to an existing CSS path like:

Code: Select all

<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uriSuffix uriSuffix="a.css" uri="local.css"/>
</catalog>
Then in the Document Type Configuration dialog in the Catalogs tab you could add a reference to that local CSS included in the document type folder.
The local.css can have empty content, it's just necessary that it exists on disk.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

afuchs
Posts: 15
Joined: Mon May 19, 2014 11:38 am

Re: Overriding xml-stylesheet PI with framework CSS

Post by afuchs » Mon May 19, 2014 2:06 pm

Thank you, Radu!

It is indeed a good option and I will probably try it out soon.

I oversaw the option "ignore CSSs in the associated document type" and as you pointed it out, I'd venture to ask: why does it not suffice to solve the problem? I.e., why is the CSS specified by the PI not ignored by oXygen?

Radu
Posts: 6335
Joined: Fri Jul 09, 2004 5:18 pm

Re: Overriding xml-stylesheet PI with framework CSS

Post by Radu » Mon May 19, 2014 2:16 pm

Hi,

The option
"ignore CSSs in the associated document type"
does what it says, it ignores the CSS associated in the document type configuration and uses only the CSS directly referenced in the document.

What you were looking for was an option like
"ignore CSSs linked in the XML document"
but we do not have this. There are very few cases like yours in which you cannot change a certain new file template not to generate a link to an invalid CSS.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

afuchs
Posts: 15
Joined: Mon May 19, 2014 11:38 am

Re: Overriding xml-stylesheet PI with framework CSS

Post by afuchs » Mon May 19, 2014 2:20 pm

Ok, sorry, I got it the right way now.

Thank you very much for your help, I am aware of my options now.

Post Reply