Page 1 of 1

Wrapping text in Tables

Posted: Thu Nov 30, 2017 3:07 pm
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

Re: Wrapping text in Tables

Posted: Thu Nov 30, 2017 3:43 pm
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

Re: Wrapping text in Tables

Posted: Thu Nov 30, 2017 4:39 pm
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

Re: Wrapping text in Tables

Posted: Thu Nov 30, 2017 5:07 pm
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/dita-users/conversations/topics/41964


Regards,
Radu

Re: Wrapping text in Tables

Posted: Mon Dec 04, 2017 12:43 pm
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>

Re: Wrapping text in Tables

Posted: Mon Dec 04, 2017 12:47 pm
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