General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Applying a custom css when using the multiple html file output

  • bholtam

    Applying a custom css when using the multiple html file output

    Participants 2
    Replies 3
    Last Activity 10 years, 10 months ago

    I've been using the XMetaL help topics, and I've been able to apply the custom CSS to the TOC that generates. However, any topic I click on from the TOC opens up with the default XMetaL css (commonltr.css) applied. Both the custom css (tcadmin.css in the example) and commonltr.css appear in the code.

    The TOC code only includes the custom css:

    I don't have a lot of experience with CSS, but I'm stumped why I can't get this to work. I feel like I've tried everything. I'm sure I've overlooking something simple. Any help would be greatly appreciated.

    Thanks

    Reply

    kwag_myers

    Reply to: Applying a custom css when using the multiple html file output

    I've found the best way is to actually use the commonltr.css file for customization. Also, make sure to Browse for the file in the Specific CSS field on the General tab of the Edit Deliverable Type dialog box to be sure the complete directory is correct.

    Reply

    Derek Read

    Reply to: Applying a custom css when using the multiple html file output

    The DITA OT seems to have a limitation that causes it to fail to put CSS links into the TOC file as you might expect it to. There is code there that looks like it should work, and I don't see why it is failing when the CSS links (that use similar code) work for the individual HTML topic files.

    The main file that does the Multiple HTML transform is this:
    xslmap2xhtmtoc.xsl

    It doesn't really do much except set up the XSLT output to be XML (to produce XHTML output) and then import this file, which does most of the work for the TOC:
    map2htmtoc.xsl

    That file is where most of the magic for the TOC happens.
    It contains this template that should build up and insert CSS links:

     
       
         
           
             
           

         

       

       
         
           
                     

           
                     

         

         
       

     

     
    My tests show that this is failing for some reason, but I can't figure out why.

    If you need a solution immediately I'd just hard code what you need into the main template and leave it at that for now. The easiest way to do that is to change the following. My new stuff is in blue. You would obviously change the text “insert your path here” to be your actual path.


     
     
       
         
         
           
           
             
           

           
             
                <br />              <xsl:value-of select="/*[contains(@class,' map/map ')]/*[contains(@class,' topic/title ')]"/><br />           
               
             

             
                <br />              <xsl:value-of select="/*[contains(@class,' map/map ')]/@title"/><br />           
               
             

           

           
           
           
           

         
         

         
           
             
               
             

           

           
           
         
         
       
     

    If I have some time I might have a look further to see what is really going on there. I suspect this should already be a known issue and that it likely would have a bug listed at the DITA OT project at SourceForge: http://sourceforge.net/tracker/?group_id=132728&atid=725074

    Reply

    Derek Read

    Reply to: Applying a custom css when using the multiple html file output

    I missed some other code that seems to be checking for the presence of the CSS file. The CSS file seems to need to be present otherwise you get nothing in the TOC (which is what you are seeing, so I assume it is the same case).

    Given the following conditions…

    • This file exists: c:cssfilesmyspecific.css
    • The setting for “Specific CSS” is: c:cssfilesmyspecific.css
    • The setting for “Default CSS path” is: cssfolderonwebsite

    …you should end up with this in the TOC file's :

    You will also see that the subfolder /cssfolderonwebsite is created for you in your output and the file c:cssfilesmyspecific.css is copied into it.

    No XSLT changes required.

    (and all of this explains why I can't find a bug at SourceForge, because the feature is working)

    Reply

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

Lost Your Password?

Products
Downloads
Support