Changing characters in the output file names

The following Wiki article describes the general process for overriding 'names.xsl' in order to customize the output (HTML) file naming convention of ePublisher:

One user asked how to reproduce the Publisher 2003 option to convert white spaces in the file names to underscores, as well as to replace the periods added by ePublisher into underscores. While this kind of customization generally falls beyond the scope of basic technical support, here are the details for the procedure:

Once you have copied names.xsl into the appropriate directory in your project folder, open it in an XML- or text-editing application. Locate the SplitPath template. In that function, we follow this general process:

  1. Store the directory path for this particular output file.
  2. Build the base file name.
    1. If there is a filename marker, use that
    2. If not, use the source file's file name (sans extension).
      1. If there is more than one split from this document, add a series of periods and numbers representing the position of the split in the project/document.
  3. Combine the base file name with the output file extension.
  4. Return the full file name combined with the output directory for this file.

So, to replace the periods with underscores, just change the periods in the appropriate lines (<xsl:text>.</xsl:text>) to underscores (<xsl:text>_</xsl:text>).

To change spaces to underscores, you'll want to modify the base file name variable before it is combined with the extension. So, change this operation:

<xsl:variable name="VarName">
 <xsl:value-of select="$VarBaseFileName" />
 <xsl:value-of select="$VarExtension" />

to this:

<xsl:variable name="VarName">
 <xsl:value-of select="translate($VarBaseFileName,' ','_')" />
 <xsl:value-of select="$VarExtension" />

Then, save names.xsl and regenerate your output to apply the changes.


LaurenLever/@Solutions/Overrides/Changing characters in output (last edited 2009-06-02 20:12:50 by LaurenLever)