This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re[2]: [docbook-apps] XSL HH htmlhelp.generate.index parameter isn't documented?


Hello Mauritz,

>From Sunday, October 17, 2004, 2:10:53 PM, you wrote:

>> -----Original Message-----
>> From: TiP 
>>   There is not much to add here. htmlhelp.generate.index parameter is
>> used in htmlhelp templates to mark whenever to generate .hhk 
>> files, but it isn't documented. The question is why?

MJ> Well, one reason could be that htmlhelp.generate.index is a variable, not a
MJ> parameter. 
MJ> Whether a HHK file should be used for the index is governed by the
MJ> htmlhelp.use.hhk parameter.

Well, this doesn't seem to be true. $htmlhelp.generate.index value is used
to determine if .hhk must be generated and it doesn't depend on
htmlhelp.use.hhk.


<xsl:template match="/">
  <xsl:if test="$htmlhelp.only != 1">
    <xsl:choose>
      <xsl:when test="$rootid != ''">
        <xsl:choose>
          <xsl:when test="count(key('id',$rootid)) = 0">
            <xsl:message terminate="yes">
              <xsl:text>ID '</xsl:text>
              <xsl:value-of select="$rootid"/>
              <xsl:text>' not found in document.</xsl:text>
            </xsl:message>
          </xsl:when>
          <xsl:otherwise>
            <xsl:message>Formatting from <xsl:value-of select="$rootid"/></xsl:message>
            <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="/" mode="process.root"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:if>

  <xsl:call-template name="hhp"/>
  <xsl:call-template name="hhc"/>
  <xsl:if test="($rootid = '' and //processing-instruction('dbhh')) or
                ($rootid != '' and key('id',$rootid)//processing-instruction('dbhh'))">
    <xsl:call-template name="hh-map"/>
    <xsl:call-template name="hh-alias"/>
  </xsl:if>
  <xsl:if test="$htmlhelp.generate.index">
    <xsl:call-template name="hhk"/>
  </xsl:if>
</xsl:template>


Can anybody explain where htmlhelp.generate.index value comes from?
What logic is hidden behind and what are possible index types for HH?


<xsl:variable name="htmlhelp.generate.index" select="//indexterm[1]"/>

<xsl:template match="indexterm">
  <xsl:choose>
    <xsl:when test="$htmlhelp.use.hhk = 0">
  
      <xsl:variable name="primary" select="normalize-space(primary)"/>
      <xsl:variable name="secondary" select="normalize-space(secondary)"/>
      <xsl:variable name="tertiary" select="normalize-space(tertiary)"/>
      
      <xsl:variable name="text">
        <xsl:value-of select="$primary"/>
        <xsl:if test="secondary">
          <xsl:text>, </xsl:text>
          <xsl:value-of select="$secondary"/>
        </xsl:if>
        <xsl:if test="tertiary">
          <xsl:text>, </xsl:text>
          <xsl:value-of select="$tertiary"/>
        </xsl:if>
      </xsl:variable>
      
      <xsl:if test="secondary">
        <xsl:if test="not(//indexterm[normalize-space(primary)=$primary and not(secondary)])">
          <xsl:call-template name="write.indexterm">
            <xsl:with-param name="text" select="$primary"/>
          </xsl:call-template>
        </xsl:if>
      </xsl:if>
      
      <xsl:call-template name="write.indexterm">
        <xsl:with-param name="text" select="$text"/>
      </xsl:call-template>
      
    </xsl:when>
    <xsl:otherwise>
      <a>
        <xsl:attribute name="name">
          <xsl:call-template name="object.id"/>
        </xsl:attribute>
      </a>
    </xsl:otherwise>
    
  </xsl:choose>
</xsl:template>


htmlhelp.use.hhk is used only twice through entire htmlhelp-common.xsl.
First time htmlhelp.use.hhk is used in <xsl:template match="indexterm">
, but I can't say what is the purpose of this template (i'd like to see
some comments in sources for that, but there aren't any).
Second time htmlhelp.use.hhk is mysterioulsy used to generate empty
.hhk files.


<xsl:template name="hhk">
  <xsl:call-template name="write.text.chunk">
    <xsl:with-param name="filename">
      <xsl:if test="$manifest.in.base.dir != 0">
        <xsl:value-of select="$base.dir"/>
      </xsl:if>
      <xsl:value-of select="$htmlhelp.hhk"/>
    </xsl:with-param>
    <xsl:with-param name="method" select="'text'"/>
    <xsl:with-param name="content"><xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
<!-- Sitemap 1.0 -->
</HEAD><BODY>
<OBJECT type="text/site properties">
</OBJECT>
<UL>]]>
</xsl:text>
<xsl:if test="($htmlhelp.use.hhk != 0) and $htmlhelp.generate.index">
  <xsl:choose>
    <xsl:when test="$rootid != ''">
      <xsl:apply-templates select="key('id',$rootid)" mode="hhk"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-templates select="/" mode="hhk"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:if>
<xsl:text disable-output-escaping="yes"><![CDATA[</UL>
</BODY></HTML>]]>
</xsl:text></xsl:with-param>
    <xsl:with-param name="encoding" select="$htmlhelp.encoding"/>
  </xsl:call-template>
</xsl:template>


-- 
 TiP


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]