Author Mode how to change default image directory

Having trouble installing Oxygen? Got a bug to report? Post it all here.
coyote
Posts: 2
Joined: Wed Apr 22, 2015 5:36 pm

Author Mode how to change default image directory

Post by coyote »

Hello!

I am new here, and new to OxygenXML. I am currently working with the DocBook Authoring and Publishing Suite (DAPS) which is a toolchain that uses the DocBook 4.5 / 5 framework created by the SUSE Linux documentation team.

DAPS by default requires a directory structure like this.

Code: Select all

 ~/Project/my_book
|--images/src/
| |--dia/
| |--fig/
| |--png/
| |--svg/
|
|--xml/
I am trying to enable images in Author mode of OxygenXML.

The problem is, the fileref is pointing to the xml directory where all the xml files of the project live. I need to point the author to the image/src/png or image/src/svg depending on file type. Other than copying the images to the xml directory :lol: is there a way to do this that is simple and efficient across the entire project?

Best,

Your local nub-cake bows before your awesomeness!
coyote
Posts: 2
Joined: Wed Apr 22, 2015 5:36 pm

Re: Author Mode how to change default image directory

Post by coyote »

What I am looking for essentially is a "button" or extension that allows you to change the default fileref in the xml directory in oxygen, and point to the location of your images directory in the project folder.
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: Author Mode how to change default image directory

Post by adrian »

Hi,

It's possible to do something like this with XML catalogs. But I don't see a way to make it generic, for any named image, only for specific images named/resolved in the catalog.
e.g. for an image named 'lake.png'

Code: Select all

<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uriSuffix uriSuffix="/lake.png" uri="images/src/png/lake.png"/>
</catalog>
Create the "catalog.xml" file with the above content and place it in the "my_book" folder.
Add this XML catalog file in Oxygen's Options > Preferences, XML / XML Catalog.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: Author Mode how to change default image directory

Post by adrian »

Hi,

There is a better way to do this for the Author mode, via CSS (without the XML catalog). You can specify for the image elements from the XML from where the images should be loaded. By default, for DocBook, the CSS snippet that handles this looks like this:

Code: Select all

graphic,
inlinegraphic,
imagedata{
content: attr(fileref, url);
}
Oxygen provides a number of CSS extension functions that can help with the redirection. In the end it would look like this (note the import with the default CSS):

Code: Select all

@import "docbook.css";

graphic,
inlinegraphic,
imagedata{
content: oxy_url(
oxy_base-uri(),
'../images/src/',
oxy_concat(oxy_substring(attr(fileref), oxy_add(oxy_lastindexof(attr(fileref), "."), 1, 'number')), '/'),
attr(fileref));
}
You can either associate this CSS in the XML for testing (Document > XML Document > Associate XSLT/CSS Stylesheet) or add it in the list of CSSs (Author tab, CSS section) from an extended DocBook 4/5 document type (Options > Preferences, Document Type Association).

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply