AntennaHouse / pdf5-ml

Antenna House PDF5-ML DITA-OT Plug-in
23 stars 9 forks source link

Flag does not work when topicref has conditional attribute #229

Closed edomonndo closed 1 year ago

edomonndo commented 1 year ago

When the topicref element has conditional attribute, the flag function does not work. We are using the flag to confirm which data is excluded. In this case we had to put an attribute to the root element of topic, and it is not what we want.

Expected result: Entire filed of the topic "xxx.dita" is highlighted in red. Actulal result: No change applied by ditaval

ToshihikoMakita commented 1 year ago

First, span>@</spanbackground="red" is not permitted, the expected notation is span>@</spanbackcolor.

http://docs.oasis-open.org/dita/dita/v1.3/errata02/os/complete/part3-all-inclusive/langRef/ditaval/ditaval-prop.html#ditaval-prop

ToshihikoMakita commented 1 year ago

Several considerations:

  1. topicref element that have span>@</spanhref to topic will be the target.
  2. topichead element cannot to be the target of this span>@</spanaction (because it has no relevant topic).
  3. To make compatibility with previous version, the new parameter will be added.
ToshihikoMakita commented 1 year ago

@edomonndo Question: If you author a.dita for the novice audience, it will be the attribute of the topic.

<topic id="id-a" audience="novice">

Why are you controlling span>@</spanaudience in map level? Does your publishing (map) defines that a.dita is for novice or for expert in map level?

edomonndo commented 1 year ago

@ToshihikoMakita

Thanks for the revision. The @backcolor attribute is correct.

Why are you controlling @audience in map level? Does your publishing (map) defines that a.dita is for novice or for expert in map level?

Yes, we do it in map as ditamap view in oXygen shows the conditions. Otherwise, we have to open each topic and it doesn't make sense.

In my opinion, topichead is also to be target. The topichead is just like a title-only topic and is able to have conditional attributes. The topicref element without href attribute is the same as topichead. While authoring we use stub as a placeholder in map.

ToshihikoMakita commented 1 year ago

Still considering the way to implement.

The Oxygen map snap. 2022-07-12-1

2022-07-12-2

It may be not so easy to apply topicref level flagging into topic content. Also topichead will need another trick to apply formatting defined in flagging.

ToshihikoMakita commented 1 year ago

Based on DITA specification, we can write following .ditaval entry.

<prop action="flag" att="audience" val="general" backcolor="#f1f1f1" color="#ff0000" style="italics">
    <startflag imageref="start.png">
        <alt-text>START</alt-text>
    </startflag>
    <endflag imageref="end.png">
        <alt-text>END</alt-text>
    </endflag>
</prop>

Should I implement startflag/@imageref, startflag/alt-text, endflag/@imageref, endflag/alt-text for topicref/@audience="general" ?

edomonndo commented 1 year ago

Although I've never used @imageref before, I think those actions are also required. Thanks.

ToshihikoMakita commented 1 year ago

I'm implementing it now.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map xml:lang="en-US">
 <title>Universal Declaration of Human Rights</title>
 <topicref href="topics/c_udhr_en.dita" audience="novice">
  <topicref href="topics/c_udhr_ja.dita">
   <topicref href="topics/c_udhr_ko-KR.dita"/>
  </topicref>
 </topicref>
 <topicref href="topics/c_uhdr_zh-CN.dita"/>
 <topicref href="topics/c_uhdr_zh-TW.dita"/>
</map>

c_udhr_en.dita

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="concept_zfy_rgl_ct" xml:lang="en-US">
 <title>Universal Declaration of Human Rights</title>
 <conbody>
  <section>
   <title>Article 1</title>
   <p>All human beings are born free and equal in dignity and rights. They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.</p>
  </section>
  <section audience="novice">
   <title>Article 2</title>
   <p><ph rev="1.0">This is revision 1.0 content</ph></p>
   <p><ph rev="2.0">This is revision 2.0 content</ph></p>
  </section>
 </conbody>
</concept>

.ditaval

    <?xml version="1.0" encoding="UTF-8"?>
    <val>
        <prop action="flag" att="audience" val="novice" backcolor="pink" color="maroon" style="italic">
        </prop>
        <revprop action="flag" val="2.0" backcolor="lightblue" color="blue" style="bold">
        </revprop>
    </val>

The output 2022-07-20-2-2

However during implementation, I found a fatal DITA-OT bug that corresponds startflag/@imageref. So, implementing image flagging will be impossible at this moment.

edomonndo commented 1 year ago

Thank you, it looks good.

Can you flag child topics as well? According to the dita spec, metadata set within a map cascades. If parent topicref has @audience, then the cascading applies to descendant topicrefs? (https://www.oxygenxml.com/dita/1.3/specs/archSpec/base/cascading-in-a-ditamap.html?hl=cascading)

ToshihikoMakita commented 1 year ago

Probably your indication is right. DITA-OT cascades @audience attribute in the merged middle file. But it does not cascade ditaval-startprop element to the topicref that is located in the descendant of topicref/@audience. As the result, DITA to PDF XSLT stylesheet must inherit ditaval-startprop element by itself. It is not an easy way to implement.

Do you have any other plugins that implements your requirement?

Example merged middle file of above sample DITA file.

<?xml version="1.0" encoding="UTF-8"?>
<dita-merge xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
            xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot"><?workdir /D:\SVN\pdf5\testdata\20220713-flag-topicref\temp\3.7.1?><?workdir-uri file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/temp/3.7.1/?><?path2project?><?path2project-uri ./?><?path2rootmap-uri ./?><?doctype-public -//OASIS//DTD DITA Map//EN?><?doctype-system map.dtd?>
   <map cascade="merge"
        class="- map/map "
        ditaarch:DITAArchVersion="1.3"
        domain="(map mapgroup-d) (topic abbrev-d) (topic delay-d) a(props deliveryTarget) (map ditavalref-d) (map glossref-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)"
        specializations="@props/deliveryTarget"
        xml:lang="en-US"
        xtrc="map:1;3:23"
        xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
      <title class="- topic/title "
             xtrc="title:1;4:9"
             xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">Universal Declaration of Human Rights</title>
      <topicref audience="novice"
                class="- map/topicref "
                first_topic_id="#unique_1"
                href="#unique_1"
                ohref="topics/c_udhr_en.dita"
                type="concept"
                xtrc="topicref:1;5:59"
                xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
         <topicmeta class="- map/topicmeta ">
            <navtitle class="- topic/navtitle ">Universal Declaration of Human Rights</navtitle>
            <?ditaot gentext?>
            <linktext class="- map/linktext ">Universal Declaration of Human Rights</linktext>
         </topicmeta>
         <ditaval-startprop class="+ topic/foreign ditaot-d/ditaval-startprop "
                            outputclass="flag__style--italic"
                            style="color:maroon;background-color:pink;">
            <prop action="flag" backcolor="pink" color="maroon" style="italic"/>
         </ditaval-startprop>
         <topicref audience="novice"
                   class="- map/topicref "
                   first_topic_id="#unique_2"
                   href="#unique_2"
                   ohref="topics/c_udhr_ja.dita"
                   type="concept"
                   xtrc="topicref:2;6:42"
                   xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
            <topicmeta class="- map/topicmeta ">
               <navtitle class="- topic/navtitle ">『世界人権宣言』</navtitle>
               <?ditaot gentext?>
               <linktext class="- map/linktext ">『世界人権宣言』</linktext>
            </topicmeta>
            <topicref audience="novice"
                      class="- map/topicref "
                      first_topic_id="#unique_3"
                      href="#unique_3"
                      ohref="topics/c_udhr_ko-KR.dita"
                      type="concept"
                      xtrc="topicref:3;7:47"
                      xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
               <topicmeta class="- map/topicmeta ">
                  <navtitle class="- topic/navtitle ">세 계 인 권 선 언</navtitle>
                  <?ditaot gentext?>
                  <linktext class="- map/linktext ">세 계 인 권 선 언</linktext>
               </topicmeta>
            </topicref>
         </topicref>
         <ditaval-endprop class="+ topic/foreign ditaot-d/ditaval-endprop ">
            <prop action="flag" backcolor="pink" color="maroon" style="italic"/>
         </ditaval-endprop>
      </topicref>
      <topicref class="- map/topicref "
                first_topic_id="#unique_4"
                href="#unique_4"
                ohref="topics/c_uhdr_zh-CN.dita"
                type="concept"
                xtrc="topicref:4;10:45"
                xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
         <topicmeta class="- map/topicmeta ">
            <navtitle class="- topic/navtitle ">世界人权宣言</navtitle>
            <?ditaot gentext?>
            <linktext class="- map/linktext ">世界人权宣言</linktext>
         </topicmeta>
      </topicref>
      <topicref class="- map/topicref "
                first_topic_id="#unique_5"
                href="#unique_5"
                ohref="topics/c_uhdr_zh-TW.dita"
                type="concept"
                xtrc="topicref:5;11:45"
                xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
         <topicmeta class="- map/topicmeta ">
            <navtitle class="- topic/navtitle ">世界人權宣言</navtitle>
            <?ditaot gentext?>
            <linktext class="- map/linktext ">世界人權宣言</linktext>
         </topicmeta>
      </topicref>
   </map>
   <?workdir /D:\SVN\pdf5\testdata\20220713-flag-topicref\temp\3.7.1\topics?>
   <?workdir-uri file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/temp/3.7.1/topics/?>
   <?path2project ..\?>
   <?path2project-uri ../?>
   <?path2rootmap-uri ../?>
   <?doctype-public -//OASIS//DTD DITA Concept//EN?>
   <?doctype-system concept.dtd?>
   <concept class="- topic/topic concept/concept "
            ditaarch:DITAArchVersion="1.3"
            domain="(topic concept) (topic abbrev-d) a(props deliveryTarget) (topic equation-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic mathml-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic svg-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)"
            id="unique_1"
            oid="concept_zfy_rgl_ct"
            specializations="@props/deliveryTarget"
            xml:lang="en-US"
            xtrc="concept:1;3:51"
            xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_en.dita">
      <title class="- topic/title "
             xtrc="title:1;4:9"
             xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_en.dita">Universal Declaration of Human Rights</title>
      <conbody class="- topic/body  concept/conbody "
               xtrc="conbody:1;5:11"
               xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_en.dita">
         <section class="- topic/section "
                  xtrc="section:1;6:12"
                  xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_en.dita">
            <title class="- topic/title "
                   xtrc="title:2;7:11"
                   xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_en.dita">Article 1</title>
            <p class="- topic/p "
               xtrc="p:1;8:7"
               xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_en.dita">All human beings are born free and equal in dignity and rights. They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.</p>
         </section>
         <section audience="novice"
                  class="- topic/section "
                  xtrc="section:2;10:30"
                  xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_en.dita">
            <ditaval-startprop class="+ topic/foreign ditaot-d/ditaval-startprop "
                               outputclass="flag__style--italic"
                               style="color:maroon;background-color:pink;">
               <prop action="flag" backcolor="pink" color="maroon" style="italic"/>
            </ditaval-startprop>
            <title class="- topic/title "
                   xtrc="title:3;11:11"
                   xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_en.dita">Article 2</title>
            <p class="- topic/p "
               xtrc="p:2;12:7"
               xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_en.dita">
               <ph class="- topic/ph "
                   rev="1.0"
                   xtrc="ph:1;12:21"
                   xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_en.dita">This is revision 1.0 content</ph>
            </p>
            <p class="- topic/p "
               xtrc="p:3;13:7"
               xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_en.dita">
               <ph class="- topic/ph "
                   rev="2.0"
                   xtrc="ph:2;13:21"
                   xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_en.dita">
                  <ditaval-startprop class="+ topic/foreign ditaot-d/ditaval-startprop "
                                     outputclass="flag__style--bold"
                                     style="color:blue;background-color:lightblue;">
                     <revprop action="flag" backcolor="lightblue" color="blue" style="bold"/>
                  </ditaval-startprop>This is revision 2.0 content<ditaval-endprop class="+ topic/foreign ditaot-d/ditaval-endprop ">
                     <revprop action="flag" backcolor="lightblue" color="blue" style="bold"/>
                  </ditaval-endprop>
               </ph>
            </p>
            <ditaval-endprop class="+ topic/foreign ditaot-d/ditaval-endprop ">
               <prop action="flag" backcolor="pink" color="maroon" style="italic"/>
            </ditaval-endprop>
         </section>
      </conbody>
      <related-links class="- topic/related-links ">
         <linkpool class="- topic/linkpool "
                   xtrc="topicref:1;5:59"
                   xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
            <linkpool class="- topic/linkpool "
                      xtrc="topicref:1;5:59"
                      xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
               <link audience="novice"
                     class="- topic/link "
                     format="dita"
                     href="#unique_2"
                     mapclass="- map/topicref "
                     ohref="topics/c_udhr_ja.dita"
                     role="child"
                     scope="local"
                     type="concept"
                     xtrc="topicref:2;6:42"
                     xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap"><?ditaot usertext?>
                  <linktext class="- topic/linktext "><?ditaot gentext?>『世界人権宣言』</linktext>
               </link>
            </linkpool>
         </linkpool>
      </related-links>
   </concept>
   <?workdir /D:\SVN\pdf5\testdata\20220713-flag-topicref\temp\3.7.1\topics?>
   <?workdir-uri file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/temp/3.7.1/topics/?>
   <?path2project ..\?>
   <?path2project-uri ../?>
   <?path2rootmap-uri ../?>
   <?doctype-public -//OASIS//DTD DITA Concept//EN?>
   <?doctype-system concept.dtd?>
   <concept class="- topic/topic concept/concept "
            ditaarch:DITAArchVersion="1.3"
            domain="(topic concept) (topic abbrev-d) a(props deliveryTarget) (topic equation-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic mathml-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic svg-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)"
            id="unique_2"
            oid="concept_v1m_nhl_ct"
            specializations="@props/deliveryTarget"
            xml:lang="ja-JP"
            xtrc="concept:1;3:51"
            xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_ja.dita">
      <title class="- topic/title "
             xtrc="title:1;4:9"
             xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_ja.dita">『世界人権宣言』</title>
      <conbody class="- topic/body  concept/conbody "
               xtrc="conbody:1;12:11"
               xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_ja.dita">
         <section class="- topic/section "
                  xtrc="section:1;13:12"
                  xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_ja.dita">
            <title class="- topic/title "
                   xtrc="title:2;14:11"
                   xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_ja.dita">第1条</title>
            <p class="- topic/p "
               xtrc="p:1;15:7"
               xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_ja.dita">すべての人間は、生まれながらにして自由であり、かつ、尊厳と権利とについて平等である。人間は、理性と良心とを授けられており、互いに同胞の精神をもって行動しなければならない。</p>
         </section>
      </conbody>
      <related-links class="- topic/related-links ">
         <linkpool class="- topic/linkpool "
                   xtrc="topicref:2;6:42"
                   xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
            <link audience="novice"
                  class="- topic/link "
                  format="dita"
                  href="#unique_1"
                  mapclass="- map/topicref "
                  ohref="topics/c_udhr_en.dita"
                  role="parent"
                  scope="local"
                  type="concept"
                  xtrc="topicref:1;5:59"
                  xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap"><?ditaot usertext?>
               <ditaval-startprop class="+ topic/foreign ditaot-d/ditaval-startprop "
                                  outputclass="flag__style--italic"
                                  style="color:maroon;background-color:pink;">
                  <prop action="flag" backcolor="pink" color="maroon" style="italic"/>
               </ditaval-startprop>
               <linktext class="- topic/linktext "><?ditaot gentext?>Universal Declaration of Human Rights</linktext>
               <ditaval-endprop class="+ topic/foreign ditaot-d/ditaval-endprop ">
                  <prop action="flag" backcolor="pink" color="maroon" style="italic"/>
               </ditaval-endprop>
            </link>
            <linkpool class="- topic/linkpool "
                      xtrc="topicref:2;6:42"
                      xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
               <link audience="novice"
                     class="- topic/link "
                     format="dita"
                     href="#unique_3"
                     mapclass="- map/topicref "
                     ohref="topics/c_udhr_ko-KR.dita"
                     role="child"
                     scope="local"
                     type="concept"
                     xtrc="topicref:3;7:47"
                     xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap"><?ditaot usertext?>
                  <linktext class="- topic/linktext "><?ditaot gentext?>세 계 인 권 선 언</linktext>
               </link>
            </linkpool>
         </linkpool>
      </related-links>
   </concept>
   <?workdir /D:\SVN\pdf5\testdata\20220713-flag-topicref\temp\3.7.1\topics?>
   <?workdir-uri file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/temp/3.7.1/topics/?>
   <?path2project ..\?>
   <?path2project-uri ../?>
   <?path2rootmap-uri ../?>
   <?doctype-public -//OASIS//DTD DITA Concept//EN?>
   <?doctype-system concept.dtd?>
   <concept class="- topic/topic concept/concept "
            ditaarch:DITAArchVersion="1.3"
            domain="(topic concept) (topic abbrev-d) a(props deliveryTarget) (topic equation-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic mathml-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic svg-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)"
            id="unique_3"
            oid="concept_dgx_l3l_ct"
            specializations="@props/deliveryTarget"
            xml:lang="ko-KR"
            xtrc="concept:1;3:51"
            xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_ko-KR.dita">
      <title class="- topic/title "
             xtrc="title:1;4:9"
             xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_ko-KR.dita">세 계 인 권 선 언</title>
      <conbody class="- topic/body  concept/conbody "
               xtrc="conbody:1;5:11"
               xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_ko-KR.dita">
         <section class="- topic/section "
                  xtrc="section:1;6:12"
                  xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_ko-KR.dita">
            <title class="- topic/title "
                   xtrc="title:2;7:11"
                   xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_ko-KR.dita">제 1 조</title>
            <p class="- topic/p "
               xtrc="p:1;8:7"
               xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_udhr_ko-KR.dita">모든 인간은 태어날 때부터 자유로우며 그 존엄과 권리에 있어 동등하다. 인간은 천부적으로 이성과 양심을 부여받았으며 서로 형제애의 정신으로 행동하여야 한다.</p>
         </section>
      </conbody>
      <related-links class="- topic/related-links ">
         <linkpool class="- topic/linkpool "
                   xtrc="topicref:3;7:47"
                   xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
            <link audience="novice"
                  class="- topic/link "
                  format="dita"
                  href="#unique_2"
                  mapclass="- map/topicref "
                  ohref="topics/c_udhr_ja.dita"
                  role="parent"
                  scope="local"
                  type="concept"
                  xtrc="topicref:2;6:42"
                  xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap"><?ditaot usertext?>
               <linktext class="- topic/linktext "><?ditaot gentext?>『世界人権宣言』</linktext>
            </link>
         </linkpool>
      </related-links>
   </concept>
   <?workdir /D:\SVN\pdf5\testdata\20220713-flag-topicref\temp\3.7.1\topics?>
   <?workdir-uri file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/temp/3.7.1/topics/?>
   <?path2project ..\?>
   <?path2project-uri ../?>
   <?path2rootmap-uri ../?>
   <?doctype-public -//OASIS//DTD DITA Concept//EN?>
   <?doctype-system concept.dtd?>
   <concept class="- topic/topic concept/concept "
            ditaarch:DITAArchVersion="1.3"
            domain="(topic concept) (topic abbrev-d) a(props deliveryTarget) (topic equation-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic mathml-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic svg-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)"
            id="unique_4"
            oid="concept_nh3_vhl_ct"
            specializations="@props/deliveryTarget"
            xml:lang="zh-CN"
            xtrc="concept:1;3:51"
            xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_uhdr_zh-CN.dita">
      <title class="- topic/title "
             xtrc="title:1;4:9"
             xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_uhdr_zh-CN.dita">世界人权宣言</title>
      <conbody class="- topic/body  concept/conbody "
               xtrc="conbody:1;5:11"
               xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_uhdr_zh-CN.dita">
         <section class="- topic/section "
                  xtrc="section:1;6:12"
                  xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_uhdr_zh-CN.dita">
            <title class="- topic/title "
                   xtrc="title:2;7:11"
                   xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_uhdr_zh-CN.dita">第一条</title>
            <p class="- topic/p "
               xtrc="p:1;8:7"
               xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_uhdr_zh-CN.dita">人人生而自由,在尊严和权利上一律平等。他们赋有理性和良心,并应以兄弟关系的精神相对待。</p>
         </section>
      </conbody>
   </concept>
   <?workdir /D:\SVN\pdf5\testdata\20220713-flag-topicref\temp\3.7.1\topics?>
   <?workdir-uri file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/temp/3.7.1/topics/?>
   <?path2project ..\?>
   <?path2project-uri ../?>
   <?path2rootmap-uri ../?>
   <?doctype-public -//OASIS//DTD DITA Concept//EN?>
   <?doctype-system concept.dtd?>
   <concept class="- topic/topic concept/concept "
            ditaarch:DITAArchVersion="1.3"
            domain="(topic concept) (topic abbrev-d) a(props deliveryTarget) (topic equation-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic mathml-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic svg-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)"
            id="unique_5"
            oid="concept_a51_23l_ct"
            specializations="@props/deliveryTarget"
            xml:lang="zh-TW"
            xtrc="concept:1;3:51"
            xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_uhdr_zh-TW.dita">
      <title class="- topic/title "
             xtrc="title:1;4:9"
             xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_uhdr_zh-TW.dita">世界人權宣言</title>
      <conbody class="- topic/body  concept/conbody "
               xtrc="conbody:1;5:11"
               xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_uhdr_zh-TW.dita">
         <section class="- topic/section "
                  xtrc="section:1;6:12"
                  xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_uhdr_zh-TW.dita">
            <title class="- topic/title "
                   xtrc="title:2;7:11"
                   xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_uhdr_zh-TW.dita">第一條</title>
            <p class="- topic/p "
               xtrc="p:1;8:7"
               xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/topics/c_uhdr_zh-TW.dita">人人生而自由,在尊嚴和權利上一律平等。他們賦有理性和良心,並應以兄弟關係的精神相對待。</p>
         </section>
      </conbody>
   </concept>
</dita-merge>
ToshihikoMakita commented 1 year ago

I found that it is impossible to cascade flagging attributes from upper topicref to lower topicref. If we write following ditamap, we got the merged middle file that .ditaval spec applied.

uhdr-test-2.ditamap

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map xml:lang="en-US">
 <title>Universal Declaration of Human Rights</title>
 <topicref href="topics/c_udhr_en.dita" audience="novice junior">
  <topicref href="topics/c_udhr_ja.dita">
   <topicref href="topics/c_udhr_ko-KR.dita" audience="expert" cascade="nomerge"/>
  </topicref>
 </topicref>
 <topicref href="topics/c_uhdr_zh-CN.dita"/>
 <topicref href="topics/c_uhdr_zh-TW.dita"/>
</map>

test-2.ditaval

<?xml version="1.0" encoding="UTF-8"?>
<val>
    <prop action="flag" att="audience" val="novice" backcolor="pink" color="maroon" style="italic">
    </prop>
    <revprop action="flag" val="2.0" backcolor="lightblue" color="blue" style="bold">
    </revprop>
</val>

The merged middle file

  <topicref audience="novice junior"
            class="- map/topicref "
            first_topic_id="#unique_1"
            href="#unique_1"
            ohref="topics/c_udhr_en.dita"
            type="concept"
            xtrc="topicref:1;5:66"
            xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
     <topicmeta class="- map/topicmeta ">
        <navtitle class="- topic/navtitle ">Universal Declaration of Human Rights</navtitle>
        <?ditaot gentext?>
        <linktext class="- map/linktext ">Universal Declaration of Human Rights</linktext>
     </topicmeta>
     <ditaval-startprop class="+ topic/foreign ditaot-d/ditaval-startprop "
                        outputclass="flag__style--italic"
                        style="color:maroon;background-color:pink;">
        <prop action="flag" backcolor="pink" color="maroon" style="italic"/>
     </ditaval-startprop>
     <topicref audience="novice junior"
               class="- map/topicref "
               first_topic_id="#unique_2"
               href="#unique_2"
               ohref="topics/c_udhr_ja.dita"
               type="concept"
               xtrc="topicref:2;6:42"
               xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
        <topicmeta class="- map/topicmeta ">
           <navtitle class="- topic/navtitle ">『世界人権宣言』</navtitle>
           <?ditaot gentext?>
           <linktext class="- map/linktext ">『世界人権宣言』</linktext>
        </topicmeta>
        <topicref audience="expert"
                  cascade="nomerge"
                  class="- map/topicref "
                  first_topic_id="#unique_3"
                  href="#unique_3"
                  ohref="topics/c_udhr_ko-KR.dita"
                  type="concept"
                  xtrc="topicref:3;7:83"
                  xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
           <topicmeta class="- map/topicmeta ">
              <navtitle class="- topic/navtitle ">세 계 인 권 선 언</navtitle>
              <?ditaot gentext?>
              <linktext class="- map/linktext ">세 계 인 권 선 언</linktext>
           </topicmeta>
        </topicref>
     </topicref>
     <ditaval-endprop class="+ topic/foreign ditaot-d/ditaval-endprop ">
        <prop action="flag" backcolor="pink" color="maroon" style="italic"/>
     </ditaval-endprop>
  </topicref>
  <topicref class="- map/topicref "
            first_topic_id="#unique_4"
            href="#unique_4"
            ohref="topics/c_uhdr_zh-CN.dita"
            type="concept"
            xtrc="topicref:4;10:45"
            xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
     <topicmeta class="- map/topicmeta ">
        <navtitle class="- topic/navtitle ">世界人权宣言</navtitle>
        <?ditaot gentext?>
        <linktext class="- map/linktext ">世界人权宣言</linktext>
     </topicmeta>
  </topicref>
  <topicref class="- map/topicref "
            first_topic_id="#unique_5"
            href="#unique_5"
            ohref="topics/c_uhdr_zh-TW.dita"
            type="concept"
            xtrc="topicref:5;11:45"
            xtrf="file:/D:/SVN/pdf5/testdata/20220713-flag-topicref/uhdr-test-2.ditamap">
     <topicmeta class="- map/topicmeta ">
        <navtitle class="- topic/navtitle ">世界人權宣言</navtitle>
        <?ditaot gentext?>
        <linktext class="- map/linktext ">世界人權宣言</linktext>
     </topicmeta>
  </topicref>

This says that we cannot know what flagging attribute is defined for style <prop action="flag" backcolor="pink" color="maroon" style="italic"/>. Consequently this may be based on the insufficient DITA-OT core implementation.

I will up this fact to the DITA-OT GitHub repository issue tracker.

edomonndo commented 1 year ago

Then okay for me to implement flagging with the topicref itself. Thank you very much.

ToshihikoMakita commented 1 year ago

Current implementation exists in "develop-flag-topicref" branch. Please download and test it by your data.

edomonndo commented 1 year ago

The plugin in branch worked as expected with my topics. Thank you.