Page 1 of 1

Use of <foreign> for embedding HTML content into topics

Posted: Wed Jun 12, 2019 7:57 pm
by davdup
Hi!
I'm having trouble using the procedure described here:
https://www.oxygenxml.com/doc/versions/ ... -html.html
I'm trying to include a small chunk of HTML into my topic content the way below (the following list is included inside the body of the topic):

Code: Select all

<ol outputclass="ol_refdocs" id="TAB_subsea_reference_books_refs">
                <li id="REF_DOC_document_10" outputclass="ref_doc_list">
                    <table frame="none" rowsep="0" colsep="1">
                        <tgroup cols="4">
                            <colspec colname="c1" colnum="1" colwidth="1*"/>
                            <colspec colname="c2" colnum="2" colwidth="1*"/>
                            <colspec colname="c3" colnum="3" colwidth="1*"/>
                            <colspec colname="c4" colnum="4" colwidth="4*"/>
                            <tbody>
                                <row>
                                    <entry colsep="0">Document 10</entry>
                                    <entry colsep="0">02</entry>
                                    <entry colsep="0">
                                        <foreign outputclass="html-embed"><![CDATA[<span class="span_test">test<span>]]></foreign>
                                    </entry>
                                    <entry colsep="0">Titre document 10</entry>
                                </row>
                            </tbody>
                        </tgroup>
                    </table>
                </li>
            </ol>
And it breaks the topic rendering in Webhelp responsive (everything else is transformed properly except the page corresponding to this topic). Am I missing something (obviously I do!!)? Any help is welcome!
Best regards

David

Re: Use of <foreign> for embedding HTML content into topics

Posted: Wed Jun 12, 2019 9:00 pm
by Radu
Hi David,

What specifically breaks in the topic rendering? Maybe you should open the equivalent generated HTML topic in Oxygen and see if there is anything fishy in there in the way in which the span inside the CDATA was preserved.

Regards,
Radu

Re: Use of <foreign> for embedding HTML content into topics

Posted: Thu Jun 13, 2019 10:01 am
by davdup
Hi Radu!
In fact the HTML page corresponding to that topic is not rendered AT ALL... I tried with a very simple DITA Map containing only this topic.
If I replace the <foreign> ...</foreign> content by something else, like "test", it works perfectly, and I have no error message whatsoever!
Here is the complete topic content.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="doclist">
    <title>Document List</title>
    <topic id="doclist_ref_books">
        <title>Subsea reference books</title>
        <body>
            <p>The following documents are the Reference Books.</p>
            <ol outputclass="ol_refdocs" id="TAB_subsea_reference_books_refs">
                <li id="REF_DOC_document_10" outputclass="ref_doc_list">
                    <table frame="none" rowsep="0" colsep="1">
                        <tgroup cols="4">
                            <colspec colname="c1" colnum="1" colwidth="1*"/>
                            <colspec colname="c2" colnum="2" colwidth="1*"/>
                            <colspec colname="c3" colnum="3" colwidth="1*"/>
                            <colspec colname="c4" colnum="4" colwidth="4*"/>
                            <tbody>
                                <row>
                                    <entry colsep="0">Document 10</entry>
                                    <entry colsep="0">02</entry>
                                    <entry colsep="0">
                                        <foreign outputclass="html-embed"><![CDATA[<span class="span_test">test<span>]]></foreign>
                                    </entry>
                                    <entry colsep="0">Titre document 10</entry>
                                </row>
                            </tbody>
                        </tgroup>
                    </table>
                </li>
            </ol>
        </body>
    </topic>
    <topic id="doclist_codes_standards">
        <title>Codes and Standards</title>
        <body>
            <ol outputclass="ol_refdocs" id="TAB_subsea_reference_books_refs">
                <li id="REF_DOC_document_1" outputclass="ref_doc_list">
                    <table frame="none" rowsep="0" colsep="1">
                        <tgroup cols="4">
                            <colspec colname="c1" colnum="1" colwidth="1*"/>
                            <colspec colname="c2" colnum="2" colwidth="1*"/>
                            <colspec colname="c3" colnum="3" colwidth="1*"/>
                            <colspec colname="c4" colnum="4" colwidth="4*"/>
                            <tbody>
                                <row>
                                    <entry colsep="0">Document 1</entry>
                                    <entry colsep="0">02</entry>
                                    <entry colsep="0">
                                        <foreign outputclass="html-embed"><![CDATA[<span class="span_test">test<span>]]></foreign>
                                    </entry>
                                    <entry colsep="0">Titre document 4</entry>
                                </row>
                            </tbody>
                        </tgroup>
                    </table>
                </li>
                <li id="REF_DOC_document_2" outputclass="ref_doc_list">
                    <table frame="none" rowsep="0" colsep="1">
                        <tgroup cols="4">
                            <colspec colname="c1" colnum="1" colwidth="1*"/>
                            <colspec colname="c2" colnum="2" colwidth="1*"/>
                            <colspec colname="c3" colnum="3" colwidth="1*"/>
                            <colspec colname="c4" colnum="4" colwidth="4*"/>
                            <tbody>
                                <row>
                                    <entry colsep="0">Document 2</entry>
                                    <entry colsep="0">02</entry>
                                    <entry colsep="0">
                                        <foreign outputclass="html-embed"><![CDATA[<span class="span_test">test<span>]]></foreign>
                                    </entry>
                                    <entry colsep="0">Titre document 2</entry>
                                </row>                            
                            </tbody>
                        </tgroup>
                    </table>
                </li>
                <li id="REF_DOC_document_3" outputclass="ref_doc_list">
                    <table frame="none" rowsep="0" colsep="1">
                        <tgroup cols="4">
                            <colspec colname="c1" colnum="1" colwidth="1*"/>
                            <colspec colname="c2" colnum="2" colwidth="1*"/>
                            <colspec colname="c3" colnum="3" colwidth="1*"/>
                            <colspec colname="c4" colnum="4" colwidth="4*"/>
                            <tbody>
                                <row>
                                    <entry colsep="0">Document 3</entry>
                                    <entry colsep="0">02</entry>
                                    <entry colsep="0">
                                        <foreign outputclass="html-embed"><![CDATA[<span class="span_test">test<span>]]></foreign>
                                    </entry>
                                    <entry colsep="0">Titre document 2</entry>
                                </row>                            
                            </tbody>
                        </tgroup>
                    </table>
                </li>
            </ol>
        </body>
    </topic>
</topic>

Any idea what can happen here?
Regards

David

Re: Use of <foreign> for embedding HTML content into topics

Posted: Thu Jun 13, 2019 1:38 pm
by Radu
Hi David,

Probably this occurs because instead of using "</span>" to end the tag you used "<span>".
So the XML should have looked like this:

Code: Select all

<foreign outputclass="html-embed"><![CDATA[<span class="span_test">test</span>]]></foreign>
Regards,
Radu

Re: Use of <foreign> for embedding HTML content into topics

Posted: Thu Jun 13, 2019 3:05 pm
by davdup
Ok... now I feel really shameful!!... :?

Re: Use of <foreign> for embedding HTML content into topics

Posted: Thu Jun 13, 2019 6:58 pm
by Radu
Hi David,

I also missed it a couple of times :) But once you said the HTML was not produced at all, it meant that somehow the fragment was not a well formed XHTML content so I took another close look at it.

Regards,
Radu