Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subject Scheme Flagging in XHTML/PDF outputs with chunking (DOT 1.7) #1442

Closed
raducoravu opened this issue Jan 22, 2013 · 6 comments
Closed
Assignees
Labels
bug preprocess/chunking preprocess/keyref preprocess priority/medium Medium (or unknown) priority issue stale No recent activity. May be closed soon.

Comments

@raducoravu
Copy link
Member

One of our users reported this http://www.oxygenxml.com/forum/post24119.html#p24119

Flagging based on subject scheme values does not work when a DITA Map has the @chunk attribute set to it.

Examples:

main.ditamap

<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map chunk="by-document to-content">
  <title>Test</title>
  <topicref href="doctor_who_subject.ditamap" format="ditamap" type="subjectScheme"/>
  <topicref href="serials_list.dita"/>
</map>

doctor_who_subject.ditamap

<!DOCTYPE subjectScheme PUBLIC "-//OASIS//DTD DITA Subject Scheme Map//EN" "map.dtd"> 
<subjectScheme>
  <subjectdef keys="era_attributedef">
    <subjectdef keys="producer">
      <subjectdef keys="sixties">
        <subjectdef keys="verity_lambert"/>
        <subjectdef keys="john_wiles"/>
        <subjectdef keys="innes_lloyd"/>
        <subjectdef keys="peter_bryant"/>
        <subjectdef keys="derrick_sherwin"/>
      </subjectdef>
      <subjectdef keys="seventies">
        <subjectdef keys="barry_letts"/>
        <subjectdef keys="philip_hinchcliff"/>
        <subjectdef keys="graham_williams"/>
      </subjectdef>
      <subjectdef keys="eighties">
        <subjectdef keys="john_nathan-turner"/>
      </subjectdef>
    </subjectdef>
  </subjectdef>
  <enumerationdef>
    <attributedef name="audience"/>
    <subjectdef keyref="era_attributedef"/>
  </enumerationdef>
</subjectScheme>

serials_list.dita:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="first_serials">
  <title>List of Doctor Who serials</title>
  <body>
    <section audience="verity_lambert">
      <title>An Unearthly Child</title>
      <p>Kidnapped!</p>
    </section>
    <section audience="john_nathan-turner">
      <title>Survival</title>
      <p>Ironically titled.</p>
    </section>
  </body>
</topic>

flag.ditaval:

<val>
  <prop action="flag" att="audience" val="sixties" color="red"/>
</val>

Errors like this are reported:

[preprocess_flag] C:\Users\radu_coravu\Desktop\DOT1.7.1\DITA-OT1.7.1\xsl\preprocess\flagImpl.xsl:759: Error! Document has been marked not available: file:/C:/Users/radu_coravu/Desktop/tait/temp/xhtml//file:/C:/Users/radu_coravu/Desktop/tait/temp/xhtml/schemekeydef.xml

Probable causes:

  1. There are many XSLs in the DITA OT with this construct:
<xsl:param name="WORKDIR">
  <xsl:apply-templates select="/processing-instruction('workdir-uri')" mode="get-work-dir"/>
</xsl:param>

But from what I looked in the temporary files folder the chunked output topic contains more than one occurance of the `? . So the match should be made more specific, using something like "/processing-instruction('workdir-uri')[1]"

  1. The chunked temporary file does no longer has a name which can be searched in files like schemekeydef.xml so the stylesheeets cannot find anymore a mapping for the topic file.
@raducoravu
Copy link
Member Author

Also in: DITA-OT1.7.1/xsl/map2htmtoc/map2htmlImpl.xsl there is an XSLT template like:

<xsl:template match="processing-instruction('workdir')" mode="get-work-dir">
  <xsl:value-of select="concat(., '/')"/>
</xsl:template>  

which is wrong because all apply-templates are in the context of the PI.
The correct template form is in the dita-utilities.xsl and probably this template is not called anyway (fortunately).

@raducoravu
Copy link
Member Author

Actually both templates in dita-utilities.xsl with modes "get-work-dir" and "get-path2project" should match the first PI from the file using [1] in the @match attribute.
Probably all parameter declarations for "WORKDIR" (and other variables matching PIs) should be searched for in all stylesheets and see how the match is made.

jelovirt added a commit that referenced this issue Jan 22, 2013
When temporary file contains multiple workdir-uri processing
instructions, only the first one should be used.
@jelovirt
Copy link
Member

@raducoravu are you able to test the fix from hotfix/1.7.2 branch?

@raducoravu
Copy link
Member Author

I tested the fix by porting the stylesheet modifications to the DITA OT 1.7 distribution I already have.
Definitely a step in the right direction which can be committed on the trunk. But still does not work with the example (I tested with the XHTML output).

If you look in the "xsl/preprocess/flagImpl.xsl" at the XSLT template:

<xsl:template match="*" mode="copy-element">

I added some xsl:messages and because of the chunking attribute the edited file name (variable $editedFileName) is something like:
Chunk1122011359.dita

And it is being searched in a properties file (variable $PROPERTIES-FILE) like "temp/xhtml/subject_scheme.dictionary" which maps only the original file names and not this random generated file name.

I do not know how this can be solved. Probably the "subject_scheme.dictionary" should have taken into consideration the chunking which is made and which changes the names of the original files.

@stale
Copy link

stale bot commented Dec 12, 2018

This issue has been automatically marked as stale because it has not been updated recently. It will be closed soon if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No recent activity. May be closed soon. label Dec 12, 2018
@raducoravu
Copy link
Member Author

I can no longer reproduce the problem with DITA OT 3.x. I'm also attaching a zip with the samples.
flagging-sbj-scheme.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug preprocess/chunking preprocess/keyref preprocess priority/medium Medium (or unknown) priority issue stale No recent activity. May be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants