Use of <foreign> for embedding HTML content into topics

Post here questions and problems related to editing and publishing DITA content.
davdup
Posts: 22
Joined: Wed May 29, 2019 5:43 pm

Use of <foreign> for embedding HTML content into topics

Post 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
Radu
Posts: 9436
Joined: Fri Jul 09, 2004 5:18 pm

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

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
davdup
Posts: 22
Joined: Wed May 29, 2019 5:43 pm

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

Post 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
Radu
Posts: 9436
Joined: Fri Jul 09, 2004 5:18 pm

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

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
davdup
Posts: 22
Joined: Wed May 29, 2019 5:43 pm

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

Post by davdup »

Ok... now I feel really shameful!!... :?
Radu
Posts: 9436
Joined: Fri Jul 09, 2004 5:18 pm

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

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply