dita-community / dita13-dita-ot-1.x-support

Plugins that add support for DITA 1.3 vocabularies to the 1.x version of the DITA Open Toolkit.
Apache License 2.0
0 stars 1 forks source link

svgref does not seem to be published neither to PDF nor to XHTML outputs #1

Open raducoravu opened 9 years ago

raducoravu commented 9 years ago

If I have a topic like:

    <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA 1.3 Topic//EN" "topic.dtd">
    <topic id="topic_tfm_thl_hs">
      <title>Test</title>
      <body>
        <p>abc<svg-container><svgref href="shapes.svg"/></svg-container>zzz</p>
      </body>
    </topic>

which points to a simple SVG like:

        <svg:svg width="125" height="125" version="1.1" xmlns:svg="http://www.w3.org/2000/svg">
            <svg:circle cx="62" cy="62" r="55" stroke-width="5" stroke="blue" fill="white"/>
        </svg:svg>

and I publish to PDF using the plugins integrated in DITA OT 1.8.5 I get a lot of errors reported in the "localFunctions.xsl" stylesheet like for example.

           D:\projects\eXml\frameworks\dita\DITA-OT\plugins\org.dita.pdf2\build.xml:324: Fatal error during transformation using D:\projects\eXml\frameworks\dita\DITA-OT\plugins\org.dita.pdf2\xsl\fo\topic2fo_shell_fop.xsl: An empty sequence is not allowed as the result of function local:getRefContextNode(); SystemID: file:/D:/projects/eXml/frameworks/dita/DITA-OT/plugins/org.dita-community.dita13.html/xsl/localFunctions.xsl; Line#: 247; Column#: -1
drmacro commented 9 years ago

SVGs are not showing up in the FO--so definitely a problem there. Will track it down.

drmacro commented 9 years ago

If found a minor, but probably not relevant typo in the PDF plugin descriptor, which I corrected. Using the distribution package on a clean OT checkout I get the SVG and MathML in the PDF for both AH and XEP using Oxygen to run the OT.

Please verify with the 1.0.1 release package.

raducoravu commented 9 years ago

I can still consistently reproduce the issue. I'm running on Windows and I'm using the Saxon 9.6 XSLT processor bundled with Oxygen. So this is at least one difference in the setup.

I looked more into the problem, in the XSLT:

     DITA-OT\plugins\org.dita-community.dita13.html\xsl\localFunctions.xsl

the function:

   <xsl:function name="local:getRefContextNode" as="element()">

uses at some point two variables, "xtrf" and "mappath". I logged their values and they are something like absolute file paths:

   [xslt] THE xtrf IS D:\projects\eXml\samples\dita\flowers\topic.dita
   [xslt] THE MAPPATH IS D:\projects\eXml\samples\dita\flowers\flowers.ditamap

Before using them you need to convert them to URLs by using "relpath:toUrl" so you should do something like:

    <xsl:variable name="refContextNode" as="node()?"
      select="if ($isPDFMergedMap)
                then (document(relpath:toUrl($mappath))/*)
                 else if (not($xtrf) and ($format = ('dita', 'ditamap'))) 
                      then $xref 
                      else document(relpath:toUrl($xtrf))/*"
    />

This seemed to fix the problem on Windows and I could see the SVG in the PDF output.

drmacro commented 9 years ago

Doh! I really need to get serious about regression testing on Windows.

I will fix.

drmacro commented 9 years ago

There appears to be a strange behavior in Saxon under Windows in which calling document-uri() on the result of document() returns a bogus URL that is the concatenation of the context node's URL and the absolute URL provided as the first (or only) argument to document(). Have posted to saxon help list for guidance.

raducoravu commented 9 years ago

It might depend on how that absolute URL received as argument looks like. Does it have a single slash after the file: protocol like?

 file:/D:/projects/eXml/samples/dita/flowers/topic.dita

because I think that should work.