DITA and XMetaL Discussion

  • mmoulder

    Wrapping in Tables

    Participants 3
    Replies 4
    Last Activity 10 years, 11 months ago

    When we generate a PDF document using Xmetal 6.0, if we have a long element such as a link, the text does not wrap within the table. This causes the text to write over itself. Is there a way to make this text wrap automatically is it exceeds the with of the column?

    Reply

    Derek Read

    Reply to: Wrapping in Tables

    By default the output is designed to shrink the word and letter spacing so that a sentence or word fits on a line. In this case as your URL is considered a “word” (no spaces) it cannot be broken to line wrap and the entire thing is gets negative “kerning” applied to the point where in some cases letter may overlap making it unreadable.

    There will be many different solutions for this, but one that I have decided seems to be best is to insert a ZERO WIDTH SPACE (U+200B) after certain characters within certain elements. This gives RenderX XEP the opportunity to break on these characters when necessary (and that take precedence over its text shrinking logic).

    In your specific case you can try something like the following. In this case I had a client that often had very long URLs included with other code inside so I was able to modify that specific template. If your long URLs are in some other element(s) then you will need to modify that/those instead. I'm not sure how easy it would be to make this universal but that might be worth looking into as well. Note that the other trick to this is that I always replace the specific character “/”.

    The following code change will work under these conditions:

    1. You generate output using the deliverable named “XMetaL Enhanced PDF via RenderX XEP”.
    2. Your URL (or whatever your long text string is) contains the character “/” at regular intervals, with each chunk divided by it being short enough to fit within the containing space. This is easily modified if you want to break at other characters instead (see code).
    3. Your URL is contained within the element . This is easily modified but you will need the name of the template used for your element. A cross file text search tool (I use Notepad++ to write my XSLT). You may need to make modifications to more than one template in some cases.

    File to change:
    %appdata%SoftQuadXMetaL SharedDITA_OTdemoxmfoCustomizationfoxslcustom.xsl

    If you will be distributing this to other users it would be best to modify the following file instead and then [url=http://forums.xmetal.com/index.php/topic,1008.msg3257.html#msg3257]redeploy[/url] the DITA OT:
    C:Program FilesCommon FilesXMetaL SharedDITA_OTdemoxmfoCustomizationfoxslcustom.xsl

    [code]
       xmlns:fo=”http://www.w3.org/1999/XSL/Format”
       xmlns:exsl=”http://exslt.org/common”
       xmlns:opentopic=”http://www.idiominc.com/opentopic”
       xmlns:exslf=”http://exslt.org/functions”
       xmlns:opentopic-func=”http://www.idiominc.com/opentopic/exsl/function”
       extension-element-prefixes=”exsl”
       exclude-result-prefixes=”opentopic exslf opentopic-func”
       version=”1.1″>

       

       
       
       
       
       
       
       
       
       
           
       
       
       
           
           
       

       


































       
    [/code]

    Remember that you need to duplicate the existing template entirely (as done here) in order to retain anything it was doing before (because an override template entirely replaces the original, it does not extend it). I usually duplicate a template right inside the file it is inside first, then make mods to the duplicate copy while testing. Then once it is working I move everything into the custom.xsl to keep things neat and tidy. Note as well that I comment where any templates I am overriding are by including a reference to the filename. This way, in future versions of the DITA OT specifically, you can find those files and check to see if you need to update your modified version.

    Reply

    Derek Read

    Reply to: Wrapping in Tables

    Here are some before and after examples.

    Reply

    mmoulder

    Reply to: Wrapping in Tables

    Thanks Derek, that was exactly what we were looking for. On a side note, we found that it already breaks on underscores by default, that doesn't help here, but we happened to notice that.

    Reply

    Derek Read

    Reply to: Wrapping in Tables

    Search for 002F (SOLIDUS) on http://unicode.org/reports/tr14/. It discusses the “SY” rule, which actually mentions that URLs containing this character may require special handling (as we have done here).

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support