OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Subject: DOCBOOK-APPS: Example of an XSL customization layer

Since it sounds like a number of people are starting to experiment
with XSL customization layers, I thought I'd share one that works.

The attached file, e-smith.xsl, is a customization layer that I've
been using for my XSL experiments.  I have a second one that I
call "e-smith-chunk.xsl" which is identical expect that the 
xsl:import statement points to "chunk.xsl" instead of "docbook.xsl".
A couple of the items in the file apply only to chunking - for 
simplicity I just have one base stylesheet, so you can ignore those
parameters in this file.

This stylesheet has worked fine with xsltproc to create a single HTML
file from an XML file.  With the path changed to 'chunk.xsl', it has
worked great to take a single XML file and chunk it out to 110+ 
individual HTML files.

Anyway, here's a customization layer that works and I offer it for anyone
else who wants to play with this stuff and learn more.

Note that you will need to change the xsl:import statement to have
the correct path to where Norm's XSL stylesheets are installed.

Have fun,

P.S. Suggestions about improvements to the stylesheet are, of course,
very welcome!

Dan York, Director of Training        dyork@e-smith.com
Ph: +1-613-751-4401  Mobile: +1-613-263-4312 Fax: +1-613-564-7739 
e-smith, inc. 150 Metcalfe St., Suite 1500, Ottawa,ON K2P 1P1 Canada
http://www.e-smith.com/            open source, open mind
<?xml version="1.0"?>

<!-- $Id: e-smith-chunk.xsl,v 1.1 2001/07/05 21:30:35 dyork Exp $ -->

<!-- HTML Stylesheet for e-smith DocBook XML documents -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

<xsl:import href="/usr/share/sgml/docbook-xsl-1.41/html/docbook.xsl"/>

<xsl:template name="user.head.content">
  <xsl:param name="node" select="."/>
  <meta name="generator" content="e-smith XSLT customization layer $Revision: 1.1 $"/>
  <xsl:comment> Generated by e-smith XSLT customization layer
      based on Norman Walsh's DocBook XSL stylesheets v1.40.
      More information at http://www.e-smith.org/docs/ 


<!-- Should chapters be labeled? 0 or 1 -->
<xsl:param name="chapter.autolabel" select="1"/>

<!-- Should sections be labeled? 0 or 1 -->
<xsl:param name="section.autolabel" select="1"/>

<!-- Should chapter number be in section number? 1.1, 1.2, etc. 0 or 1 -->
<xsl:param name="section.label.includes.component.label" select="1" doc:type="boolean"/>

<!-- If 1, puts first section on separate page from Chapter page -->
<xsl:param name="chunk.first.sections" select="'1'"/>

<!-- To what depth (in sections) should the TOC go? -->
<xsl:param name="toc.section.depth" select="2"/>

<!-- Should graphics be used for admonitions (notes, warnings)? 0 or 1 -->
<xsl:param name="admon.graphics" select="0"/>

<!-- If 1 above, what is path to graphics? -->
<xsl:param name="admon.graphics.path">

<!-- When chunking, use id attribute as filename? 0 or 1 -->
<xsl:param name="use.id.as.filename" select="1"/>

<!-- Put an horizontal rule above each question -->
<xsl:template match="qandaentry">
  <div class="{name(.)}">

<!-- Custom 'emphasis' template to allow 'role="strong"' to 
     also produce a bold item. -->

<xsl:template match="emphasis">
    <xsl:when test="@role='bold'">
      <xsl:call-template name="inline.boldseq"/>
    <xsl:when test="@role='strong'">
      <xsl:call-template name="inline.boldseq"/>
      <xsl:call-template name="inline.italicseq"/>

<!-- Custom 'programlisting' template that will generate a gray
     background to the item. -->
<xsl:template match="programlisting|screen|synopsis">
  <xsl:param name="suppress-numbers" select="'0'"/>
  <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>

  <xsl:if test="@id">
    <a href="{$id}"/>

    <xsl:when test="$suppress-numbers = '0'
                    and @linenumbering = 'numbered'
                    and $use.extensions != '0'
                    and $linenumbering.extension != '0'">
      <xsl:variable name="rtf">
      <table border="0" bgcolor="#E0E0E0" width="90%">
      <pre class="{name(.)}">
        <xsl:call-template name="number.rtf.lines">
          <xsl:with-param name="rtf" select="$rtf"/>
      <table border="0" bgcolor="#E0E0E0" width="90%">
      <pre class="{name(.)}">


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Powered by eList eXpress LLC