Skip to main content
1-Visitor
Nov 29, 2011 4:40 PM UTC
Question

DITA Publish to Web HTML

Hi,


My DITA Topics are held in quite a complex folder hierarchy and when I publish to Web HTML it reproduces that hierarchy for the output too, however I have found that if there are too many levels then my browser can't handle it.


Is there a way to flatten to only one folder level e.g.


Now:


\Level 1\1.html


\Level 1\Level 2\2.html


\Level 1\Level 2\Level 3\3.html



Required:


\Level 1\1.html


\Level 2\2.html


\Level 3\3.html



I did a search in Help Center for "publishing dita documents" and it says that I can change this behaviour in the style file but I can't find where...


Thanks


Pete


    3 replies

    1-Visitor
    Nov 29, 2011 9:30 PM UTC
    In Styler 6.0, there is an "HTML Chunking" button on the "Breaks" tab,
    which should let you control file names.

    -Brandon 🙂


    Translate
    peter.li1-VisitorAuthor
    1-Visitor
    Nov 29, 2011 10:54 PM UTC

    Hey Brandon,


    I've found those settings, but have no idea how to configure them to get the desired output, any ideas?


    It seems like there should be a simple switch to say yes or no for multiple levels but it's proving elusive.


    Thanks


    Pete

    Translate
    1-Visitor
    Nov 30, 2011 12:15 AM UTC
    A simple switch would be problematic in the general case. What
    happens if two files in different directories have the same name? A
    custom rule for how to handle such corner cases would be needed.

    Setting the "Persistent file name" field in the "HTML Chunking" dialog
    to "yes" will allow you to specify what the name (including path, but
    not extension) should be. You can supply the name in an attribute or
    via an XPath expression. The string functions in XPath 1.0 are rather
    weak, but I got something like what you described with this:

    concat(substring-before(@ch:filename, '/'), '/', substring-before(@id, '_'))

    This is probably not very robust, but something like it may suffice
    for your purposes, if there's reasonable consistency of certain
    attributes in your source. When crafting something like this, the
    Resolved Document for Styling is your friend, as it shows you all of
    the markup that you have to work with.

    -Brandon 🙂


    Translate