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

"An empty sequence is not allowed" XSLT error [DITA OT 2.2.2 and older] #2212

Closed
raducoravu opened this issue Jan 29, 2016 · 16 comments
Closed
Labels
bug plugin/xhtml Issue relate to XHTML plug-in priority/high High severity or high priority issue
Milestone

Comments

@raducoravu
Copy link
Member

In my DITA topic I have a CALS table like this:

<table frame="none">
    <title>Flowers</title>
    <tgroup cols="3">
        <colspec colname="c1" colnum="1" colwidth="171.0pt"/>
        <colspec colname="c2" colnum="2" colwidth="99.0pt"/>
        <colspec colname="c3" colnum="3" colwidth="99.0pt"/>
        <thead>
            <row>
                <entry colname="c2">Flower</entry>
                <entry>Flower</entry>
                <entry colname=" c3 ">Type</entry>
            </row>
        </thead>
        <tbody>
            <row>
                <entry>Snowdrop</entry>
                <entry>perennial</entry>
                <entry>perennial</entry>
            </row>
        </tbody>
    </tgroup>
</table>

and I publish to XHTML. The publishing breaks with:

D:\projects\eXml\frameworks\dita\DITA-OT2.x\plugins\org.dita.xhtml\build_general.xml:182: Fatal error during transformation using D:\projects\eXml\frameworks\dita\DITA-OT2.x\plugins\org.dita.xhtml\xsl\dita2xhtml.xsl: An empty sequence is not allowed as the value of variable $colspec; SystemID: file:/D:/projects/eXml/frameworks/dita/DITA-OT2.x/plugins/org.dita.xhtml/xsl/xslhtml/dita2htmlImpl.xsl; Line#: 2106; Column#: -1

@jelovirt jelovirt added bug plugin/xhtml Issue relate to XHTML plug-in priority/medium Medium (or unknown) priority issue labels Jan 29, 2016
@jelovirt jelovirt added this to the 2.2.3 milestone Jan 29, 2016
@raducoravu
Copy link
Member Author

But probably the problem resides in the code which rewrites the table colspecs, the initial columns named "c1", "c2"... seem to be rewritten as "col1", "col2".. but not everywhere. The table in the example is probably not valid according to the specs but it's very hard to detect the problem from the error message.

@raducoravu
Copy link
Member Author

For the same sample the PDF generation complains with:

 D:\projects\eXml\frameworks\dita\DITA-OT2.x\plugins\org.dita.pdf2\build.xml:297: Fatal error during transformation using D:\projects\eXml\frameworks\dita\DITA-OT2.x\plugins\org.dita.pdf2.fop\xsl\fo\topic2fo_shell_fop.xsl: An empty sequence is not allowed as the value of variable $entryNumber; SystemID: file:/D:/projects/eXml/frameworks/dita/DITA-OT2.x/plugins/org.dita.pdf2/xsl/fo/tables.xsl; Line#: 426; Column#: -1

@raducoravu
Copy link
Member Author

Another example of invalid CALS table which breaks the XHTML generation:

        <table frame="none">
            <title>Flowers</title>
            <tgroup cols="1">
                <thead>
                    <row>
                        <entry>Flower1</entry>
                        <entry>Flower2</entry>
                    </row>
                </thead>
                <tbody>
                    <row>
                        <entry>Snowdrop</entry>
                        <entry>perennial</entry>
                    </row>
                </tbody>
            </tgroup>
        </table>

but this one works in the PDF output.

@jelovirt jelovirt added the needs reproduction Issue needs to be reproduced in latest release label Jan 29, 2016
@jelovirt
Copy link
Member

Does this occur with develop code?

@raducoravu
Copy link
Member Author

I can still reproduce the problem with both samples when publishing to XHTML, the error is at an identical location for both cases:

[xslt] C:\Users\radu_coravu\Documents\dot-develop\src\main\plugins\org.dita.xhtml\xsl\xslhtml\dita2htmlImpl.xsl:2094: Fatal Error! An empty sequence is not allowed as the value of variable $colspec

@eerohele eerohele removed the needs reproduction Issue needs to be reproduced in latest release label Feb 2, 2016
@eerohele
Copy link

eerohele commented Feb 2, 2016

I can also reproduce the issue.

I guess the problem is really that both of these examples are really content issues. I at least don't really know how the incongruous colspec names in the first tables should be interpreted. The second table has the wrong @cols value.

I suppose the NormalizeTableFilter class could print a warning or throw an error in both of these cases, but I there might be a pretty big number of cases like that to account for. Schematron would probably be a good fit for this sort of "error" checking.

The shortcut is to make DITA-OT ignore errors like these like this (I think this has been proposed as a solution in other related issues, as well):

diff --git a/src/main/plugins/org.dita.xhtml/xsl/xslhtml/dita2htmlImpl.xsl b/src/main/plugins/org.dita.xhtml/xsl/xslhtml/dita2htmlImpl.xsl
index d7b47b9..438806e 100644
--- a/src/main/plugins/org.dita.xhtml/xsl/xslhtml/dita2htmlImpl.xsl
+++ b/src/main/plugins/org.dita.xhtml/xsl/xslhtml/dita2htmlImpl.xsl
@@ -2091,7 +2091,7 @@
   <xsl:variable name="row" select=".." as="element()"/>
   <xsl:variable name="body" select="../.." as="element()"/>
   <xsl:variable name="group" select="../../.." as="element()"/>
-  <xsl:variable name="colspec" select="../../../*[contains(@class, ' topic/colspec ')][@colname and @colname = $this-colname]" as="element()"/>
+  <xsl:variable name="colspec" select="../../../*[contains(@class, ' topic/colspec ')][@colname and @colname = $this-colname]" as="element()?"/>
   <xsl:variable name="table" select="../../../.." as="element()"/>

   <xsl:variable name="framevalue">

@raducoravu
Copy link
Member Author

@eerohele I agree with everything, actually in Oxygen XML Editor 18.0 we'll have table layout validation done automatically as the user is editing each topic. Also agree with fixing the XSLT stylesheets to make the publishing succeed. Because XSLT errors like the ones reported now "An empty sequence is not allowed...." don't help anyone and the same samples worked with DITA OT 1.8. Indeed some proper table validation done in a certain stage of the DITA OT processing could be interesting (although it should probably be done on DOM and not SAX) but it's something not very easy to do.

@raducoravu
Copy link
Member Author

By the way, for the first example the PDF processing also fails at:

 An empty sequence is not allowed as the value of variable $entryNumber; ...........  org.dita.pdf2/xsl/fo/tables.xsl; Line#: 426

@jelovirt
Copy link
Member

Related to this, I'm actually not sure if we want to have the column name normalization code. Since the transtype specific code should not rely on the column names to be the source of which column index the column is part of. Thus, I would prefer to keep the column names the same as before and then just use the custom attributes to provide additional information to make transtype processing easier.

@robander
Copy link
Member

robander commented May 2, 2016

This one's tagged as 2.2.3 but was not fixed there - removing the tag.

@robander robander closed this as completed May 2, 2016
@robander robander reopened this May 2, 2016
@robander
Copy link
Member

robander commented May 2, 2016

(But didn't mean to close it, hit the wrong button.)

@robander
Copy link
Member

robander commented May 6, 2016

The just-closed issue #1715 is another instance of bad CALS markup (@colnum values in the wrong order) that throws off table processing. If we ever update our table processing to add any of the CALS validation mentioned above, this is another thing to check for.

@deegle
Copy link

deegle commented Aug 18, 2016

Thanks. Solved the issue after much head scratching. I will propagate out to our team. One small thing, in OT 2.2, line number is 2108.

@jelovirt jelovirt added priority/high High severity or high priority issue and removed priority/medium Medium (or unknown) priority issue labels Mar 28, 2017
@jelovirt jelovirt added this to the 2.4.6 milestone Mar 28, 2017
jelovirt added a commit that referenced this issue Mar 28, 2017
The output might not be as expected because the table markup is invalid, but the processing
will not be halted by an exception during XSLT conversion.
infotexture added a commit to dita-ot/docs that referenced this issue Apr 17, 2017
Signed-off-by: Roger Sheen <roger@infotexture.net>
infotexture added a commit to dita-ot/docs that referenced this issue Apr 18, 2017
* hotfix/2.4.6:
  Push extended description to `args.gen.task.lbl`
  Combine info on dita-ot/dita-ot#2651 & #2212
  Fix docs milestone link
  Add info on dita-ot/dita-ot#2650 to 2.4.6 RN
  Add info on dita-ot/dita-ot#2549 to 2.4.6 RN
  Add info on dita-ot/dita-ot#2212 to 2.4.6 RN
  Add preliminary issue list to 2.4.6 Release Notes
  Bump 'maintenance-version' key to “2.4.6”
infotexture added a commit to dita-ot/docs that referenced this issue Apr 18, 2017
* hotfix/2.4.6:
  Push extended description to `args.gen.task.lbl`
  Combine info on dita-ot/dita-ot#2651 & #2212
  Fix docs milestone link
  Add info on dita-ot/dita-ot#2650 to 2.4.6 RN
  Add info on dita-ot/dita-ot#2549 to 2.4.6 RN
  Add info on dita-ot/dita-ot#2212 to 2.4.6 RN
  Add preliminary issue list to 2.4.6 Release Notes
  Bump 'maintenance-version' key to “2.4.6”
  Remove obsolete unreferenced files
  Fix typo in closing target tag (#140)
  Use latest DITA-OT version (2.4.5) for CI builds
@raducoravu
Copy link
Member Author

There is also this problem when two cells overlap on the same row:

    <table id="table_mlp_h1w_tz">
      <tgroup cols="7">
        <colspec colnum="1" colname="col1"/>
        <colspec colnum="2" colname="col2"/>
        <colspec colnum="3" colname="col3"/>
        <colspec colnum="4" colname="col4"/>
        <colspec colnum="5" colname="col5"/>
        <colspec colnum="6" colname="col6"/>
        <colspec colnum="7" colname="col7"/>
        <tbody>
          <row>
            <entry>
              <p> </p>
              <p>K2</p>
            </entry>
            <entry namest="col2" nameend="col3">K3</entry>
            <entry namest="col3" nameend="col4">K4</entry>
            <entry>
              <p> </p>
              <p>K5</p>
            </entry>
            <entry/>
          </row>
        </tbody>
      </tgroup>
    </table>

and the publishing breaks with an error like:

/Applications/Oxygen XML Editor/frameworks/dita/DITA-OT2.x/plugins/org.dita.xhtml/xsl/xslhtml/tables.xsl:370:2: Fatal Error! An empty sequence is not allowed as the value of variable $colspec

which could either be more precise, have a better message or we could relax the checks.

@pwright73
Copy link

Can this repair be retrofitted to OT 2.3.1? Stuck on that version for the time being.

@raducoravu
Copy link
Member Author

You can probably try to open the XSLT "DITA-OT2.3.1/plugins/org.dita.xhtml/xsl/xslhtml/tables.xsl" and apply @robander 's fix on it:

9550f10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug plugin/xhtml Issue relate to XHTML plug-in priority/high High severity or high priority issue
Projects
None yet
Development

No branches or pull requests

6 participants