Page 1 of 1

Plugin selects all references except a ditavalref

Posted: Tue Jul 26, 2022 4:23 pm
by gbv34
Hello,
I'm currently working on a plugin based on the one created by Radu:
https://github.com/oxygenxml/dita-export-map

It works well, but I notice that if I include a ditavalref in my map, the exportmap won't include the ditaval file in the archive, and in my case it is really necessary. I think this is related to xslt generateAllResources.xsl used in the process:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    version="2.0">
    <xsl:output method="text"/>
    <xsl:template match="/">
        <xsl:for-each select="distinct-values(//file/@path)">
            <xsl:value-of select="."/>
            <xsl:text>
</xsl:text>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
Do you have any idea or tip to make it work?
Thank you so much :)

Re: Plugin selects all references except a ditavalref

Posted: Wed Jul 27, 2022 9:06 am
by Radu
Hi,

The latest stylesheet from the project contains some changes to fix problems induced by the fact that key scopes and branch filtering renames resources:
https://github.com/oxygenxml/dita-expor ... ources.xsl
But even without those changes the ditaval should have been included in the zip? Is the DITAVAL in the same folder as the DITA Map or in a subfolder? Or do you have it in some folder outside of the DITA map folder? Because this latter situation might not work.

Regards,
Radu

Re: Plugin selects all references except a ditavalref

Posted: Wed Jul 27, 2022 10:31 am
by gbv34
Hi Radu,
Indeed, I used an older version of the XSLT and updated it. However, you're right the ditaval should be included.
Currently, my map references the ditaval, placed in a subfolder, with a ditavalref as its end:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
    <title>Colors of life: <ph otherprops="red">Red</ph><ph otherprops="yellow">Yellow</ph><ph
            otherprops="black">Black</ph><ph otherprops="green">Green</ph></title>
    <topicmeta>
        <othermeta name="ft:description" content="This is a publication about colors and how it is possible to use ditavals"/>
    </topicmeta>
    <topicref href="topics/t_red.dita" otherprops="red"/>
    <topicref href="topics/t_yellow.dita" otherprops="yellow">
        <topicref href="topics/t_orange.dita" otherprops="orange yellow"/>
    </topicref>
    <topicref href="topics/t_black.dita" otherprops="black">
        <topicref href="topics/t_gray.dita" otherprops="gray"/>
    </topicref>
    <topicref href="topics/t_green.dita" otherprops="green"/>
    <ditavalref href="ditavals/red.ditaval" format="ditaval"/>
</map>

Re: Plugin selects all references except a ditavalref

Posted: Wed Jul 27, 2022 1:03 pm
by Radu
Hi,
I'm attaching the small project I'm working with, I cannot reproduce the problem on my side.
flowers.zip
Regards,
Radu

Re: Plugin selects all references except a ditavalref

Posted: Thu Jul 28, 2022 3:29 pm
by gbv34
Thank you, Radu.
Indeed, it worked well with your publication. I recreated the map for my project and it worked. I did a comparison between the two sources and didn't notice any difference. Strange but luckily it is solved :)

Re: Plugin selects all references except a ditavalref

Posted: Sat Jul 30, 2022 5:39 pm
by gbv34
Hi Radu!
Here is a quick update.
I partially found out the reason for my problem. The situation occurred when I used the plugin online in a CCMS and I noticed that preprocessing with DITA-OT applied the filtering during the preprocessing and before the execution of the plugin that creates an archive with all the resources from the map. Therefore, the ditaval is indeed included in the archive, but topics filtered out are removed from it. However, in my case, I need all the topics to be wrapped in the archive.

I've tried to override the branch-filter process in the dita2exportmap.init target with:

Code: Select all

<property name="preprocess.branch-filter.skip" value="true"/>
    <property name="preprocess.chunk.skip" value="true"/>
    <property name="preprocess.copy-image.skip" value="true"/>
    <property name="preprocess.profile.skip" value="true"/>
    
However, it didn't have any effect.
So my question is: Is it possible to override the filtering during OT preprocessing? If so, I guess my declaration in the ant target was incorrect.
Otherwise, if it is not possible to override the branch-filter extension point, is it possible to change the order of execution of the steps involved in the preprocessing?

Re: Plugin selects all references except a ditavalref

Posted: Mon Aug 01, 2022 7:44 am
by Radu
Hi,
Yes, the fact that profiling it taken into account is a feature of the plugin.
About trying to impose values for params like "preprocess.branch-filter.skip", are you using branch filtering in your DITA Map (the "ditavalref" element)?
There are two preprocess possibilities, "preprocess" and "preprocess2", the build file "plugins/org.dita.base/build_preprocess2_template.xml" takes the skip parameter into account but if you look in the build file "plugins/org.dita.base/build_preprocess.xml" it does not:

Code: Select all

  <target name="branch-filter">
    <pipeline taskname="branch-filter" message="Filter branches">
      <module class="org.dita.dost.module.BranchFilterModule"/>
    </pipeline>
  </target>
The build file:
https://github.com/oxygenxml/dita-expor ... /build.xml
depends on the "preprocess" task:

Code: Select all

  <target name="dita2exportmap" depends="dita2exportmap.init, build-init, preprocess, map2exportmap"/>
which does not take this param into account.
If you look at the definition of the "preprocess" task in "plugins/org.dita.base/build_preprocess.xml" it calls various other tasks, among which the filtering tasks:

Code: Select all

<target name="preprocess" depends="com.oxygenxml.cleanOutput,preprocess.init,ditaval-merge,gen-list,debug-filter,mapref,branch-filter,keyref,copy-to,conrefpush,conref,profile,topic-fragment,chunk,move-meta-entries,maplink,topicpull,clean-map,clean-preprocess,copy-files" description="Preprocessing ended"/>
So in the "dita2exportmap" target you could replace the "preprocess" task reference with explicit references to tasks called by the "preprocess" task, removing the tasks that you do not want to be executed like "branch-filter".

Regards,
Radu

Re: Plugin selects all references except a ditavalref

Posted: Mon Aug 01, 2022 3:35 pm
by gbv34
Your help is invaluable and I cannot thank you enough for your support.
I used preprocess2 instead of preprocess and applied my preprocess.branch-filter.skip property.
Everything runs perfectly :)