How to reference the user defined DTD when creating new task

lhsihan
Posts: 26
Joined: Thu Aug 15, 2019 5:31 pm

How to reference the user defined DTD when creating new task

Post by lhsihan » Fri Aug 23, 2019 1:41 am

Hi experts,
I have defined one own task type DTD and put it
1. following http://dita4practitioners.github.io/dit ... shell.html to create one folder named "C:\Program Files\Oxygen XML Editor 21\frameworks\dita\DITA-OT3.x\plugins\com.example.doctype.userdefine" for own DTD task type shell.
2. package the DTD task shell as the DITA OT.
3. as I run the "ant -f integrator.xml" failed, so I manually updated the "C:\Program Files\Oxygen XML Editor 21\frameworks\dita\DITA-OT3.x\plugins\org.dita.base\catalog-dita.xml" to add the below lines:

Code: Select all

  <nextCatalog catalog="../com.example.doctype.userdefine/catalog.xml"/>
4. according to https://www.oxygenxml.com/doc/versions/ ... gin_method, I created a new folder called template_folders inside the C:\Program Files\Oxygen XML Editor 21\frameworks\dita\DITA-OT3.x\plugins\ directory and move the folder created by step 1 to it.

But when I new one new file, couldn't find my own task file template.
Could you please help me with this and see if there are anything wrong? Or could you please point me that how to reference the user defined DTD when creating new task?

PS: the folder "com.example.doctype.userdefine" has been added in this question. Thanks a lot
com.example.doctype.userdefine.zip
(8.81 KiB) Downloaded 14 times

Radu
Posts: 6507
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to reference the user defined DTD when creating new task

Post by Radu » Fri Aug 23, 2019 9:39 am

Hi,

For step (3) I answered you here:

post55028.html#p55028

for step (4) our documentation is incorrect and we'll rectify it, the new file template should be created in the folder structure: OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT3.x\plugins\com.example.doctype.userdefine\template_folders\. So the "template_folders" folder needs to be inside your plugin's folder and not inside the parent "plugins" folder.
In my case I created for tests this new file template:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT3.x\plugins\com.example.doctype.userdefine\template_folders\Tasks\CustomTask.xml

with the contents:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "urn:pubid:dita4practitioners.com:doctypes:dita:task" "task.dtd">
<task id="${id}">
    <title></title>
    <taskbody></taskbody>
</task>
I looked more into your plugin because it still does not properly work. In the DTD "com.example.doctype.userdefine\task\dtd\task.dtd" this reference:

Code: Select all

<!ENTITY % task-type
  PUBLIC "-//OASIS//ELEMENTS DITA 1.3 Task//EN"
         "task.mod"
>%task-type;
is resolved preferring the public ID to the DITA 1.3 task.mod instead of yours. You could replace it with:

Code: Select all

<!ENTITY % task-type SYSTEM "task.mod"
>%task-type;
to force the reference to resolve to your custom task.mod.

Same for this reference:

Code: Select all

<!ENTITY % task-dec
  PUBLIC "-//OASIS//ENTITIES DITA 1.3 Task//EN"
         "task.ent"
>%task-dec;

you can replace it with:

Code: Select all

<!ENTITY % task-dec
  SYSTEM 
         "task.ent"
>%task-dec;
so that your custom "task.ent" is used.

You will also need a couple more changes, replace:

Code: Select all

<!ENTITY % strictTaskbody-def 
  PUBLIC "-//OASIS//ELEMENTS DITA 1.3 Strict Taskbody Constraint//EN"
         "strictTaskbodyConstraint.mod"
>%strictTaskbody-def;
with:

Code: Select all

<!ENTITY % strictTaskbody-def SYSTEM 
         "strictTaskbodyConstraint.mod"
>%strictTaskbody-def;
and create a "strictTaskbodyConstraint.mod" module file next to your custom "task.mod" containing:

Code: Select all

<!ENTITY taskbody-constraints
  "(topic task strictTaskbody-c)"
>
<!ENTITY % prereq                                          "prereq">
<!ENTITY % context                                         "context">
<!ENTITY % steps                                           "steps">
<!ENTITY % steps-unordered                                 "steps-unordered">
<!ENTITY % result                                          "result">
<!ENTITY % tasktroubleshooting                             "tasktroubleshooting">
<!ENTITY % example                                         "example">
<!ENTITY % postreq                                         "postreq">
This is necessary because the original "strictTaskbodyConstraint.mod" defines the entity "taskbody.content" and because it's included first you cannot override it anymore.
I'm attaching my changes below:
com.example.doctype.userdefine.zip
(10.1 KiB) Downloaded 18 times
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

lhsihan
Posts: 26
Joined: Thu Aug 15, 2019 5:31 pm

Re: How to reference the user defined DTD when creating new task

Post by lhsihan » Fri Aug 23, 2019 11:27 am

Thanks a lot Radu. The steps and example is very clear.

Still have one further question: when I tried to create one CustomTask type file document, the default postfix for the new file in "save as" line of "New" dialog is "xxxxxxxx.xml"

How can I change it to "xxxxx.dita"?

Radu
Posts: 6507
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to reference the user defined DTD when creating new task

Post by Radu » Mon Aug 26, 2019 8:05 am

Hi,

Try to change the template file name from "CustomTask.xml" to "CustomTask.dita".

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

lhsihan
Posts: 26
Joined: Thu Aug 15, 2019 5:31 pm

Re: How to reference the user defined DTD when creating new task

Post by lhsihan » Mon Aug 26, 2019 10:30 am

Thanks so much Radu。 This is really helpful.

Post Reply