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]

Re: xtchunk.xsl - Navigation Images and xml editors


> From: Brendan Boyle <brendan@shadowtech.com.au>
> 
> I have just started to create all my documents in docbook format and
> convert them to html, pdf, fop using the saxon parser. From what I can
> tell xtchunk.xsl, docbook.xsl, chunk-common.xsl and chunker.xsl handle
> the formatting of the multiple html file ouput.

Actually, if you are using Saxon, then the one you want
to use is chunk.xsl, not xtchunk.xsl which is only
for James Clark's XT processor.  You just have to specify
chunk.xsl to Saxon and it will import the chunk-common.xsl and
chunker.xsl files.
 
> What I would like to do is output images instead of text for the
> navigation in the header and footer of the page.  I am very new to xml
> and still learning the syntax so I'm completely lost as to where to
> modify the files to do this.
> 
> I have spent quite some time searching mailing list archives and google
> for an answer without any success.  If someone has already done this or
> has a pointer to where instructions for newbies may be I would greatly
> appreciate the help.

The change you want to make will require creating a
stylesheet customization layer and adding a couple
of modified XSL templates.  Since you are chunking,
you can create a customization layer by simply
copying chunk.xsl to another filename like custom.xsl
and add your changes there. Then you tell Saxon to
use custom.xsl.

The HTML header and footer output is controlled by templates
named 'header.navigation' and 'footer.navigation' which
are in chunk-common.xsl.  You'll need to copy them to
your customization file and modify them.
I've reproduced footer.navigation
here and marked the points where text is generated.
That's where you will want to have it generate <img> tags
instead.


<xsl:template name="footer.navigation">
  <xsl:param name="prev" select="/foo"/>
  <xsl:param name="next" select="/foo"/>
  <xsl:variable name="home" select="/*[1]"/>
  <xsl:variable name="up" select="parent::*"/>

  <xsl:if test="$suppress.navigation = '0'">
    <div class="navfooter">
      <hr/>
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left">
            <xsl:if test="count($prev)>0">
              <a accesskey="p">
                <xsl:attribute name="href">
                  <xsl:call-template name="href.target">
                    <xsl:with-param name="object" select="$prev"/>
                  </xsl:call-template>
                </xsl:attribute>
change --->     <xsl:call-template name="gentext.nav.prev"/>
              </a>
            </xsl:if>
            <xsl:text>&#160;</xsl:text>
          </td>
          <td width="20%" align="center">
            <xsl:choose>
              <xsl:when test="$home != .">
                <a accesskey="h">
                  <xsl:attribute name="href">
                    <xsl:call-template name="href.target">
                      <xsl:with-param name="object" select="$home"/>
                    </xsl:call-template>
                  </xsl:attribute>
change --->       <xsl:call-template name="gentext.nav.home"/>
                </a>
              </xsl:when>
              <xsl:otherwise>&#160;</xsl:otherwise>
            </xsl:choose>
          </td>
          <td width="40%" align="right">
            <xsl:text>&#160;</xsl:text>
            <xsl:if test="count($next)>0">
              <a accesskey="n">
                <xsl:attribute name="href">
                  <xsl:call-template name="href.target">
                    <xsl:with-param name="object" select="$next"/>
                  </xsl:call-template>
                </xsl:attribute>
change --->     <xsl:call-template name="gentext.nav.next"/>
              </a>
            </xsl:if>
          </td>
        </tr>

        <tr>
          <td width="40%" align="left">
drop? -->   <xsl:apply-templates select="$prev" mode="object.title.markup"/>
            <xsl:text>&#160;</xsl:text>
          </td>
          <td width="20%" align="center">
            <xsl:choose>
              <xsl:when test="count($up)>0">
                <a accesskey="u">
                  <xsl:attribute name="href">
                    <xsl:call-template name="href.target">
                      <xsl:with-param name="object" select="$up"/>
                    </xsl:call-template>
                  </xsl:attribute>
change --->       <xsl:call-template name="gentext.nav.up"/>
                </a>
              </xsl:when>
              <xsl:otherwise>&#160;</xsl:otherwise>
            </xsl:choose>
          </td>
          <td width="40%" align="right">
            <xsl:text>&#160;</xsl:text>
drop? --->  <xsl:apply-templates select="$next" mode="object.title.markup"/>
          </td>
        </tr>
      </table>
    </div>
  </xsl:if>
</xsl:template>

The lines that use 'gentext' templates generate 'Prev'
and 'Next' and such.  The lines that use
'object.title.markup' generate the titles of the
next and previous sections.  You didn't say if
you wanted to drop those titles or not.

You'll want to replace the gentext calls
with literal <img> result elements
For example, replace:

  <xsl:call-template name="gentext.nav.next"/>

with:

  <img src="images/next.jpg" >
    <xsl:attribute name="alt">
      <xsl:call-template name="gentext.nav.next"/>
    </xsl:attribute>
  </img>

This still keeps the generated "Next" text (in the
appropriate language) in the alt attribute.

Of course, an easier approach is to make a feature
request that navigational icons be a parameter
that you can set without modifying templates.    8^)
Seems like a nice feature that others could use.

bobs
Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
Caldera International, Inc.                 fax:   (831) 429-1887
                                            email: bobs@caldera.com

----------------------------------------------------------------
To subscribe or unsubscribe from this elist use the subscription
manager: <http://lists.oasis-open.org/ob/adm.pl>


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