Customizing topicmerge.xsl - how to pass dita.temp.dir as parameter?

12 views
Skip to first unread message

vicmor...@gmail.com

unread,
Sep 7, 2021, 7:58:11 AM9/7/21
to DITA-OT Users
Hi,

I have my own plugin to customize PDF output.

I'm customizing topicmerge.xsl. I've added my own template to handle <image> elements. Works fine, using the org.dita.pdf.xsl.topicmerge extension point.

In my template I need to know the path to the dita.temp.dir and I can't find out how to pass this into the XSLT transformation.

I've done this before for the FO transformations, e.g. when customizing the xslfo XSLT transformations, by using the dita.conductor.pdf2.param extension point. But the same approach doesn't seem to work for topicmerge.xsl?

Here's what I tried for passing the parameter into my custom topicmerge.xsl:

1/ define a custom parameterfile in plugin.xml:
  <feature extension="dita.conductor.pdf2.param" file="buildParameters.xml"/>
Here's also the reference to my custom topicmerge.xsl:
  <feature extension="org.dita.pdf2.xsl.topicmerge" file="xsl/common/topicmerge.xsl"/>

2/ define parameter in buildParameters.xml and assign ${dita.temp.dir}:
  <param name="radsol.dita.temp.dir" expression="${dita.temp.dir}"/>

3/ declare the parameter in my custom topicmerge.xsl
  <xsl:param name="radsol.dita.temp.dir" select="'not-set'"/>
and use it in the transformations:
  <xsl:variable name="job" select="document(resolve-uri('.job.xml', $radsol.dita.temp.dir))" as="document-node()?"/>

4/ run dita.bat --install

Now when I try to read the $radsol.dita.temp.dir parameter in topicmerge.xsl, it has the default value from the <xsl:param> declaration, while I expected it to contain the value of ${dita.temp.dir}.

I have also found elsewhere in the pdf2 plugin, in topic.xsl, a parameter $work.dir.url, that also contains ${dita.temp.dir}. I can see in build.xml that this parameter is explicitly assigned in the transform.topic2fo.main target, in the <xslt> task.

The transformation that I'm working on, topicmerge.xsl, is called from the map2pdf2 target, but as a <module> task instead of an <xslt> task. So I have no idea how I should pass parameters into it, not by using the proper extension mechanisms, nor by hacking the plugin code...

But I'm quite confident that there's something very obvious that I'm overlooking :)))

Best regards,
Vic

vicmor...@gmail.com

unread,
Sep 7, 2021, 8:52:44 AM9/7/21
to DITA-OT Users
Hi,
as it usually happens, asking the question is already part of the answer.
I've tried an alternative approach, customizing topicpull i.o. topicmerge transformations, and that seems to work, because topicpull transformations have extension points for XSLT (dita.xsl.topicpull) and for parameters (dita.preprocess.topicpull.param).
Still if anyone would be able to clarify why (if) topicmerge doesn't seem to have similar extension possibilities, that would be welcome!
Thanks!
Vic
Op dinsdag 7 september 2021 om 13:58:11 UTC+2 schreef vicmor...@gmail.com:
Reply all
Reply to author
Forward
0 new messages