Page 1 of 1

Setting images for admonitions

Posted: Fri Oct 11, 2013 4:03 pm
by Ioana
I'm having trouble with setting the images to be used for admonitions (PDF output).

In my document, I have the following bit:

Code: Select all

<tip><para>The amount of disk space required by a project depends on the number of lines of code.</para></tip>
In my customization layer, I added the following:

Code: Select all

<xsl:param name="admon.graphics.extension">.svg</xsl:param>	
<xsl:param name="admon.graphics.path">C:\Program Files\Oxygen XML Editor 15\frameworks\docbook\xsl\images\</xsl:param>
I am expecting my PDF to use the tip.svg image in frameworks\docbook\xsl\images... but instead, I get the tip.png image under frameworks\docbook\css\img. I tried to change the extension; I also tried to set base.dir and set the admon.graphics.path as relative... still get the wrong image in PDF. Am I missing something obvious? Thanks!

Re: Setting images for admonitions

Posted: Fri Oct 11, 2013 5:26 pm
by sorin_ristache
Hi Ioana,

The value of the admon.graphics.path parameter must be a URL, not a file path. For example in the built-in Docbook transformations that come in Oxygen you can see that this value is: ${frameworks}/docbook/css/img/ which will be expanded to a URL that will point to a sub-directory of the Oxygen install directory, because the ${frameworks} Oxygen variable is expanded to a URL, in your case: file:/C:/Program%20Files/Oxygen%20XML%20Editor%2015/frameworks/. Please set a URL in the admon.graphics.path parameter as required by the Docbook transformations.


Regards,
Sorin

Re: Setting images for admonitions

Posted: Fri Oct 11, 2013 5:58 pm
by Ioana
Thanks for pointing me in the right direction! I managed to get it working, but there's still something I don't understand.

I checked the Configure Parameters window (Configure Transformation Scenario > Edit > Configure) and admon.graphics.path was indeed set to ${frameworks}/docbook/css/img/. Then, in my xsl file, I changed the line to:

Code: Select all

<xsl:param name="admon.graphics.path">${frameworks}/docbook/xsl/images/</xsl:param>
but the value displayed in Configure Parameters did not change (it was still ${frameworks}/docbook/css/img/). Once I edited it manually, I could generate the PDF the way I wanted it. My question is: aren't the values in Configure Parameters derived from my stylesheet (the one I set under XSL URL)?

Re: Setting images for admonitions

Posted: Mon Oct 14, 2013 10:14 am
by sorin_ristache
In the Configure Parameters dialog box only the default values of the parameters are derived from the stylesheet set under XSL URL, that is the parameters displayed with a normal font. If a value was set manually in this dialog box (the parameter is displayed with a bold font) this value will override the default value from the stylesheet.

Did you create your Docbook transformation by duplicating an existing transformation in which the admon.graphics.path parameter was bolded? If yes it will keep its value because it is not the value from the stylesheet (it is not displayed with normal font).


Regards,
Sorin

Re: Setting images for admonitions

Posted: Mon Oct 14, 2013 10:21 am
by Ioana
Yep, I duplicated one of the predefined transformations, that explains it. Thanks!

Re: Setting images for admonitions

Posted: Thu Nov 21, 2013 6:04 pm
by Ioana
I'm coming back to this topic since something still doesn't seem right.

To get my transformation scenario, I duplicated an existing one (DocBook PDF) and then I manually unset all the parameters. In the Edit scenario window, the Parameters button shows 0. In the Configure parameters window, admon.graphics.path displays the correct path, in my case ${frameworks}/docbook/xsl/images/. Despite this, if I generate my PDF, I don't get admonition graphics in the output.

The workaround is simple: I edit the admon.graphics.path parameter and I click OK without changing anything. Now the parameter is displayed in bold, the path is the same, and I do get admonition images in the document. Is this a bug?

Re: Setting images for admonitions

Posted: Fri Nov 22, 2013 6:00 pm
by sorin_ristache
When the Parameters button shows 0, after you unset manually all parameters, admon.graphics.path should have the default value picked up from the XSLT stylesheet, and that is: images/. I don't understand how this parameter has the value ${frameworks}/docbook/xsl/images/ in your case, when it is displayed in normal font (not bolded anymore), after you unset the parameter. What Oxygen version do you use?


Regards,
Sorin

Re: Setting images for admonitions

Posted: Fri Nov 22, 2013 6:03 pm
by Ioana
I think it's normal because I use a customization layer and I set the parameter there as ${frameworks}/docbook/xsl/images/. Or at least that's my understanding of how customization layers work with oXygen. (I'm on 15.1, but I had made all customizations in 15 and copied them over.)

Re: Setting images for admonitions

Posted: Fri Nov 22, 2013 6:13 pm
by sorin_ristache
OK I understand now. You may use the variable ${frameworks} only in the Oxygen GUI, not in an XSLT stylesheet. It is an Oxygen variable which is replaced with an actual physical file path by Oxygen before the transformation is started. If you use it directly in the XSLT stylesheet nobody will replace it.


Regards,
Sorin

Re: Setting images for admonitions

Posted: Fri Nov 22, 2013 6:21 pm
by Ioana
That explains it! Thanks a lot :)