schematron rule for bookmap

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

schematron rule for bookmap

Post by vishwavaranasi »

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: 8991
Joined: Fri Jul 09, 2004 5:18 pm

Re: schematron rule for bookmap

Post by Radu »

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: 140
Joined: Fri Feb 28, 2020 4:02 pm

Re: schematron rule for bookmap

Post by vishwavaranasi »

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: 8991
Joined: Fri Jul 09, 2004 5:18 pm

Re: schematron rule for bookmap

Post by Radu »

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: 140
Joined: Fri Feb 28, 2020 4:02 pm

Re: schematron rule for bookmap

Post by vishwavaranasi »

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: 8991
Joined: Fri Jul 09, 2004 5:18 pm

Re: schematron rule for bookmap

Post by Radu »

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: 140
Joined: Fri Feb 28, 2020 4:02 pm

Re: schematron rule for bookmap

Post by vishwavaranasi »

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

Thanks,
vishwa
Thanks,
vishwa
Post Reply