Wrapping text in Tables

Questions about XML that are not covered by the other forums should go here.
Sangeeta
Posts: 14
Joined: Fri Nov 24, 2017 10:07 am

Wrapping text in Tables

Post by Sangeeta »

Hi,

I have some text written in <codeph> tag which is not wrapping. I used the code provided in this URL. After that most components are wrapping in the table. However some instances of text in <codeph> is not wrapping.

https://groups.yahoo.com/neo/groups/dit ... pics/35559

How can we get the <codeph> text which is like a long string to wrap in table?

Best regards,
Sangeeta
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Wrapping text in Tables

Post by Radu »

Hi Sangeeta,

Using Oxygen's "Insert From Character map" (from the main "Edit" menu) you can search for a character called "zero width space" and add it manually inside the codeph content. It will not show up but the PDF processor will be able to break the line there when producing the PDF.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Sangeeta
Posts: 14
Joined: Fri Nov 24, 2017 10:07 am

Re: Wrapping text in Tables

Post by Sangeeta »

Hi Radu,

Thank you for the solution, but we have many instances of codeph.
Right now I am creating a customized plugin for PDF. I am using DITA to Print book. Will it be possible to add it in the plugin?

Best regards,
Sangeeta
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Wrapping text in Tables

Post by Radu »

Hi,

At some point on the DITA Users List Eliot Kimber proposed an XSLT solution to automatically add zero-width-space in certain text nodes:

https://groups.yahoo.com/neo/groups/dit ... pics/41964


Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Sangeeta
Posts: 14
Joined: Fri Nov 24, 2017 10:07 am

Re: Wrapping text in Tables

Post by Sangeeta »

Hi Radu,

So I add the text to tables.xsl? It is not working...Can you please suggest?

Code: Select all


<xsl:template match=”text()[matches(., ‘^(\w+=,).+’)]”>
<xsl:sequence select=”string-join(split(., ‘,’), ‘,&#x200b;’)”/>
</xsl:template>
<xsl:function name=”local:addBreakPointsToString” as=”xs:string”>
<xsl:param name=”text” as=”xs:string”/>
<xsl:variable name=”result” as=”xs:string”
select=”local:insertBreakPoints($text, ())”
/>
<xsl:sequence select=”$result”/>
</xsl:function>
<xsl:function name=”local:insertBreakPoints” as=”xs:string”>
<xsl:param name=”text” as=”xs:string?”/>
<xsl:param name=”resultString” as=”xs:string?”/>
<xsl:choose>
<xsl:when test=”not($text)”>
<xsl:sequence select=”$resultString”/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name=”pre” select=”substring($text, 1, 5)” as=”xs:string”/>
<xsl:variable name=”rest” select=”substring($text, 6)” as=”xs:string?”/>
<xsl:sequence select=”local:insertBreakPoints($rest, concat($resultString, ‘&#x200b;’, $pre)”/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Wrapping text in Tables

Post by Radu »

Hi,

You need to start debugging your own XSLT code. There are "xsl:message"'s which can be added inside xsl:templates and which show up in the "DITA OT" console view.
You can also try to register on the Yahoo Groups DITA Users List and ask around.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply