discuss: LDP XSLT stylesheet (was Re: Gnome Help 2.0)


Previous by date: 18 Jul 2001 18:00:13 -0000 Re: Green on black in HTML, Jorge Luiz Godoy Filho
Next by date: 18 Jul 2001 18:00:13 -0000 Re: Mail Lists -- NewsGroups..., Poet/Joshua Drake
Previous in thread:
Next in thread: 18 Jul 2001 18:00:13 -0000 Re: LDP XSLT stylesheet (was Re: Gnome Help 2.0), Poet/Joshua Drake

Subject: LDP XSLT stylesheet (was Re: Gnome Help 2.0)
From: Dan York ####@####.####
Date: 18 Jul 2001 18:00:13 -0000
Message-Id: <20010718135934.W14570@e-smith.com>

Folks,

> into HTML for rendering.  I certainly agree that customizations are
> needed, since the GNOME customizations probably aren't appropraite for
> the LDP docs, and vice-versa.  I'm not sure how we'll find the
> stylesheets, perhaps John can answer better than I.

Okay, am I the *only* one from here subscribed to the ####@####.####
mailing list?  I sent out a sample LDP XSLT stylesheet to that list back
on July 5th:

http://list.linuxdoc.org/archive/index.htm?2:mss:101:200107:blelgagecbakmkflfgfc

There were *no* comments about it, so I assumed everyone else was either:
a) too busy; or b) not experimenting with XSLT.  I guess I did not 
consider that there could be "c) most people are not subscribed to the list".

Anyway, here it is again attached.  I tried to go through 'ldp.dsl' and
come up with equivalents in XSLT. I got many of our customizations, although
there are a couple of things (like legal notices on a separate page) that 
Norm has not yet implemented in his stylesheets.

I named the stylesheet 'ldp-html-chunk.xsl' because it chunks out a 
DocBook XML document into many different (linked) HTML files.  Rather
than the style of 'ldp.dsl' where we have a single stylesheet that is 
called differently for print and HTML, I would recommend that we have
different stylesheets for use depending on whether you want to chunk
the document or create a single HTML page.

And since the single HTML page and chunking would be identical except
for the underlying file from Norm's stylesheets that is called
('docbook.xsl' vs. 'chunk.xsl'), it might be worthwhile to have
an 'ldp-html-common.xsl' that was then imported into 
'ldp-html-chunk.xsl' and 'ldp-html-single.xsl'.  Each of those two
files could simply be something like (depending on paths):

  <?xml version='1.0'?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version='1.0'
                xmlns="http://www.w3.org/TR/xhtml1/transitional"
                exclude-result-prefixes="#default">

      <xsl:import href="/usr/share/sgml/docbook-xsl-1.40/html/chunk.xsl"/>
      <xsl:import href="ldp-html-common.xsl"/>
  </xsl:stylesheet>

In any event, here's an XSLT customization layer for folks to try out.
It should do most of what ldp.dsl does.

Regards,
Dan

~
~
~           
-- 
Dan York, Director of Training        ####@####.####
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'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version='1.0'
                xmlns="http://www.w3.org/TR/xhtml1/transitional"
                exclude-result-prefixes="#default">

<!-- Experimental stylesheet by Dan York
     This is an attempt to replicate the customizations done in ldp.dsl
     5 Jul 2001 -->

<!-- Change this to the path to where you have installed Norman
     Walsh's XSL stylesheets -->
<xsl:import href="/usr/share/sgml/docbook-xsl-1.40/html/chunk.xsl"/>

<!-- NOT IN LDP.DSL
     Creates header content in all generated HTML files -->
<xsl:template name="user.head.content">
  <xsl:param name="node" select="."/>
  <meta name="generator" content="Experimental LDP.XSL v1.0"/>
  <xsl:comment> Generated by LDP XSLT customization layer
      based on Norman Walsh's DocBook XSL stylesheets v1.40.
      More information at http://www.linuxdoc.org/ </xsl:comment>
</xsl:template>

<!-- declare-characteristic preserve-sdata?
     No longer appears necessary as it is a JadeTex issue. -->

<!-- generate-legalnotice-link? -->

<!-- If using admon graphics (1 below), what is path to graphics? -->
<xsl:param name="admon.graphics.path">
/usr/share/sgml/docbook-xsl-1.40/images
</xsl:param>

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

<!-- Make funcsynopsis look pretty -->
<xsl:param name="funcsynopsis.decoration" select="1" doc:type="boolean"/>

<!-- Extension for HTML files -->
<xsl:param name="html.ext" select="'.html'"/>

<!-- Generate TOCs for book, article, part -->
<xsl:param name="generate.book.toc" select="1" doc:type="boolean"/>
<xsl:param name="generate.article.toc" select="1" doc:type="boolean"/>
<xsl:param name="generate.part.toc" select="1" doc:type="boolean"/>

<!-- generate-book-titlepage -->

<!-- generate-article-titlepage -->

<!-- Equivalent to chunk-skip-first-element-list - forces TOC on separate page 
     If 0, first sect is on page for chapter or article -->
<xsl:param name="chunk.first.sections" select="'1'"/>


<!-- NOT IN LDP.DSL -->
<!-- Create chunks for top-level sections. If 0, chunks will only be
     created for chapters/appendixes, and NOT for sectx elements -->
<xsl:param name="chunk.sections" select="'1'"/>

<!-- list-element-list - NO LONGER NEEDED - bug fix -->

<!-- Filename for the root chunk -->
<xsl:param name="root.filename" select="'index'"/>

<!-- shade-verbatim 
     I have created a function below that shades the verbatim sections.
     logic would need to be added to check if this is set. -->

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

<!-- graphic-extensions - NO LONGER NEEDED?? -->

<!-- default graphic filename extension -->
<xsl:param name="graphic.default.extension" select="'.gif'" doc:type="string"/>

<!-- 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"/>

<!-- Related to section labels, should those labels include the chapter
     number in them (i.e., 1.1, 1.2, 1.3, 1.4 )-->
<xsl:param name="section.label.includes.component.label" select="1" doc:type="boolean"/>

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

<!-- Custom 'emphasis' template to allow 'role="strong"' to 
     also produce a bold item. -->
<xsl:template match="emphasis">
  <xsl:choose>
    <xsl:when test="@role='bold'">
      <xsl:call-template name="inline.boldseq"/>
    </xsl:when>
    <xsl:when test="@role='strong'">
      <xsl:call-template name="inline.boldseq"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:call-template name="inline.italicseq"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<!-- book-titlepage-recto-elements
     article-titlepage-recto-elements 
     article-titlepage-recto-mode 
     article-title 
     
     - Customizing these elements (for instance, to list what is on the
       title page) involves writing a layer for html/titlepage.templates.xml and the
       other files html/titlepage.xsl and html/titlepage.templates.xsl - Norm
       is doing something funky here and I haven't fully figured it out. -->

<!-- The remainder of ldp.dsl deals with changing the foreground and
     background colors of verbatim elements although in reading through the
     DSSSL it doesn't look like it actually changed the foreground colors. 
     The changing of the background shading can be done at two locations
     (one numbered, one not) in the template below. -->

<!-- Custom template for programlisting, screen and synopsis to 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:if>

  <xsl:choose>
    <xsl:when test="$suppress-numbers = '0'
                    and @linenumbering = 'numbered'
                    and $use.extensions != '0'
                    and $linenumbering.extension != '0'">
      <xsl:variable name="rtf">
        <xsl:apply-templates/>
      </xsl:variable>
      <!-- Change the color bacground color in the line below. -->
      <table border="0" bgcolor="#E0E0E0" width="90%">
      <tr><td>
      <pre class="{name(.)}">
        <xsl:call-template name="number.rtf.lines">
          <xsl:with-param name="rtf" select="$rtf"/>
        </xsl:call-template>
      </pre>
      </td></tr></table>
    </xsl:when>
    <xsl:otherwise>
      <!-- Change the color bacground color in the line below. -->
      <table border="0" bgcolor="#E0E0E0" width="90%">
      <tr><td>
      <pre class="{name(.)}">
        <xsl:apply-templates/>
      </pre>
      </td></tr></table>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

</xsl:stylesheet>

Previous by date: 18 Jul 2001 18:00:13 -0000 Re: Green on black in HTML, Jorge Luiz Godoy Filho
Next by date: 18 Jul 2001 18:00:13 -0000 Re: Mail Lists -- NewsGroups..., Poet/Joshua Drake
Previous in thread:
Next in thread: 18 Jul 2001 18:00:13 -0000 Re: LDP XSLT stylesheet (was Re: Gnome Help 2.0), Poet/Joshua Drake


  ©The Linux Documentation Project, 2014. Listserver maintained by dr Serge Victor on ibiblio.org servers. See current spam statz.