Fun with Format Traits Info!

Posted on: October 27th, 2010 No Comments

Here at WebWorks, we would love to help everyone get ePublisher to do everything possible and make all of your wildest dreams come true.  Most of the times we can at least come up with a compromise or direct users into a forum where they can find the information or experiment via the Wiki, or one of our many events such as Study Hall or Power Hour.  Sometimes, however,  with the magic of XSL and our Format Trait Info you can do amazing things. Today’s example comes from a desire to have certain HTML elements emitted with paragraphs via our interface. By the way, this is an extension of this article except that you do not need to take into account the Page.asp modifications as we are just adding some HTML given a certain paragraph style.

So, say for example you are wanting a paragraph style only after the main headings.  Let’s say we  are calling this style “Chapter”.

  1. Navigate to the Targets directory of your project, navigate to the [target name]
  2. Create the Transforms directory
  3. Navigate to the installation directory, by default this is c:\Program Files\WebWorks\ePublisher
  4. From the version you are using, for example 2010.2,  go to the Formats folder
  5. Go to Microsoft Help 1.x, for example, if that is what you are using * it is very important to select the right format, else the XSL files will not work properly*
  6. Navigate to the Transforms folder of that Format
  7. Copy the content.xsl and pages.fti to the Targets\[your target]\Transforms directory in your project
  8. Open up the content.xsl file and look for the following: <!– Use character styles? –>
  9. We are using this code:
    <xsl:variable name="VarUseCharacterStylesOption" select="$ParamOverrideRule/wwproject:Options/wwproject:Option[@Name = 'use-character-styles']/@Value" />
    <xsl:variable name="VarUseCharacterStyles" select="(string-length($VarUseCharacterStylesOption) = 0) or ($VarUseCharacterStylesOption = 'true')" />

    to make the following changes in these variables:

    <!-- Emit Horizontal Rule-->
    <xsl:variable name="VarEmitHorizontalRuleOption" select="$ParamOverrideRule/wwproject:Options/wwproject:Option[@Name = 'emit-horizontal-rule']/@Value " />
    <xsl:variable name="VarEmitHorizontalRule" select="$VarEmitHorizontalRuleOption = 'true'" />
    <xsl:if test="$VarEmitHorizontalRule">
    <hr align="right" />
    </xsl:if>
  10. Now we are going to search in the pages.fti for the “use-character-styles” option and do the same with that template to create:
    <Option name="emit-horizontal-rule" group="options" default="false">
    <OptionClass name="boolean" />
    </Option>
  11. Now, in the project, you will go to Paragraph Styles -> Chapter -> Options, and then you will see the emit-paragraph-styles dropdown,  select Enabled to make the horizontal rule show up

Makes sense? Basically, the logic goes if you are wanting to change anything specific about a paragraph style but not do it to every paragraph style, you will want to create an FTI setting based on an <xsl:if> statement written in the XSL. So in general, and use with caution,  if you are just working with a certain paragraph style for the XSL/FTI:

1. Declare the  FTI modification variable and select

2. Declare the HTML modification variable and select.

3.  Start the if statement with the HTML modification set to true

4. Create the HTML

5.  Close the if statement

6.  Add the FTI modification in the FTI file for a Boolean variable

Leave a Reply

This blog is protected by Dave\'s Spam Karma 2: 14087 Spams eaten and counting...