Wrapping text in Tables

Questions about XML that are not covered by the other forums should go here.
Sangeeta
Posts: 8

Wrapping text in Tables

Thu Nov 30, 2017 3:07 pm

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: 5125

Re: Wrapping text in Tables

Thu Nov 30, 2017 3:43 pm

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: 8

Re: Wrapping text in Tables

Thu Nov 30, 2017 4:39 pm

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: 5125

Re: Wrapping text in Tables

Thu Nov 30, 2017 5:07 pm

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

Re: Wrapping text in Tables

Mon Dec 04, 2017 12:43 pm

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: 5125

Re: Wrapping text in Tables

Mon Dec 04, 2017 12:47 pm

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

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 2 guests