schematron rule for bookmap

Post here questions and problems related to oXygen frameworks/document types.
vishwavaranasi
Posts: 33
Joined: Fri Feb 28, 2020 4:02 pm

schematron rule for bookmap

Post by vishwavaranasi » Mon Dec 21, 2020 3:27 pm

Hi Team , our plugin has rule files , the rules for topics was working fine ,the rule for example

Code: Select all

<sch:pattern id="shortdesc_length">    
    <sch:rule context="*[contains(@class, ' topic/shortdesc ')]">
      <sch:let name="text" value="normalize-space(.)"/>
      <sch:assert role="warning" test="string-length($text) &lt; 250"> Short description cannot exceed 250
        characters. </sch:assert>
    </sch:rule>
  </sch:pattern> 
this is working fine when i run "validate and check completeness"

but for the bookmap we have the following , this is just to testing purpose we have added a rule as below

Code: Select all

 <sch:pattern>
      <sch:rule context="/*[contains(@class, ' bookmap/bookmap ')]" role="warn">
      <sch:report test="@id">
       testing id is there or not </sch:report>
    </sch:rule>
</sch:pattern>
this is not reporting even my bookmap has the "id" attribute. when am running "validate and check completeness"

would you please help here.


Thanks,
vishwa
Thanks,
vishwa

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

Re: schematron rule for bookmap

Post by Radu » Tue Dec 22, 2020 8:23 am

Hi,

I tested and this works for me.
The DITA Bookmap I used for tests is DTD-based:

Code: Select all

<!DOCTYPE bookmap PUBLIC "-//OASIS//DTD DITA BookMap//EN" "bookmap.dtd">
<bookmap id="taskbook">
    <booktitle>
    ....
    
What kind of bookmap are you using? Does it use a DTD as a schema or does it use an XML Schema or Relax NG schema? Is it a specialization of the DITA bookmap element?

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

vishwavaranasi
Posts: 33
Joined: Fri Feb 28, 2020 4:02 pm

Re: schematron rule for bookmap

Post by vishwavaranasi » Tue Dec 22, 2020 1:05 pm

Yes Radu , we have custom DTD of DITA bookmap

<!DOCTYPE bookmap PUBLIC "-//XXXXX//DTD XXX DITA Bookmap//EN" "xxxBookmap.dtd">

and similarly for task and other DITA types for example for task have this


<!DOCTYPE task PUBLIC "-//XXXXX//DTD EPM DITA Task//EN" xxxTask.dtd">

We have mapped validation to custom our rules.sch file , this rule file validating the task successfully , but for bookmap it is not.
Thanks,
vishwa

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

Re: schematron rule for bookmap

Post by Radu » Tue Dec 22, 2020 1:17 pm

Hi,

Let's try this:

Open the bookmap in the Oxygen main editor area, select in the Outline view the <bookmap> root element and then look in the "Attributes" view at the value of the "class" attribute, you can right click in the table there and copy it. Is the Schematron rule properly constructed to match that @class attribute value?

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

vishwavaranasi
Posts: 33
Joined: Fri Feb 28, 2020 4:02 pm

Re: schematron rule for bookmap

Post by vishwavaranasi » Tue Dec 22, 2020 2:49 pm

yes , checked class value it showing this - map/map bookmap/bookmap

and rule tried like this

Code: Select all

<sch:pattern id="isbookmaphasid">
    <sch:rule context="/*[contains(@class, ' map/map bookmap/bookmap ')]" role="warn">
      <sch:report test="@id">
        testing id is there or not </sch:report>
    </sch:rule>
  </sch:pattern>
also

Code: Select all

<sch:pattern id="isbookmaphasid">
    <sch:rule context="/*[contains(@class, ' map/map ')]" role="warn">
      <sch:report test="@id">
        testing id is there or not </sch:report>
    </sch:rule>
  </sch:pattern>
  
also

Code: Select all

<sch:pattern id="isbookmaphasid">
    <sch:rule context="/*[contains(@class, ' bookmap/bookmap ')]" role="warn">
      <sch:report test="@id">
        testing id is there or not </sch:report>
    </sch:rule>
  </sch:pattern>
none is worked
Thanks,
vishwa

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

Re: schematron rule for bookmap

Post by Radu » Tue Dec 22, 2020 2:58 pm

Hi,

This report

Code: Select all

<sch:report test="@id">
is triggered if there is an @id attribute set on the <bookmap> root element, I assume you have an @id attribute set on the root element, right?
Can you further simplify the rule context "contains" condition like:

Code: Select all

 <sch:rule context="/*[contains(@class, 'bookmap')]" role="warn">
does that work?
If not maybe you can put together a small sample project with a small DITA bookmap, a Schematron file, the DITA specialization DTDs, send them to us (support@oxygenxml.com) and we can take a look.

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

vishwavaranasi
Posts: 33
Joined: Fri Feb 28, 2020 4:02 pm

Re: schematron rule for bookmap

Post by vishwavaranasi » Mon Jan 18, 2021 4:33 pm

Thanks Radu , We have figured out the problem we have , the issue resolved.

Thanks,
vishwa
Thanks,
vishwa

Post Reply