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: Conditional Transformation with XSL


Hi All!

We are planing to use DocBook for our userdocumentation. For this
purpose we need to generate different kinds of documentation for online
and print media. Several chapters, sections, imageobjects should only
appear on online media or only on print media.

We decided to use the "arch" attribute for this kind of separation.
If there is an arch="print" defined the content of the tag should
only be available in the PDF-Target and if there is an arch="online"
the content should only be availabe on online media. I know this
attribute was mentioned for other things, but we didn't found any
other appropriate attribute within the common attributes.

Anyway I started to write my own driver-file which look like
this:

############################> online_driver.xsl
<########################

<!-- ******************************************************************
     Modular DocBookX XSL-Stylesheet driver-file
     ******************************************************************
     
     This file contains special customizing for all online documents
(HTML,
     HTML-Help, JavaHelp, etc.). All customizing done here will be
included
     to the other driver files for special rendering.

     
                                    Ali Saffari <asaffari@pironet.com>

     ******************************************************************
-->

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

<!-- this is needed to convert the german special characters correctly
-->
<xsl:output encoding="ISO-8859-1"/>

<!-- turn off the auto enumeration for parts, chapters and so on -->
<xsl:param name="part.autolabel" select="0"/>
<xsl:param name="chapter.autolabel" select="0"/>
<xsl:param name="preface.autolabel" select="0"/>

<!-- changing the default path to the admon graphics -->
<xsl:param name="admon.graphics.path">./images/</xsl:param>

...
<xsl:template match="para">
  <xsl:if test="@arch='online' or not(@arch)">
  <p>
    <xsl:if test="@id">
      <a name="{@id}"/>
    </xsl:if>
    <xsl:apply-templates/>
  </p>
  </xsl:if>
</xsl:template>
...

##########################################################################

As you can see it for the para-template, I've taken the definition from 
the html-styleshhet and wrapped it with a <xsl:if ...> tag. Now I got
two
questions:

General Question:

Is this the right way for doing this kind of customization? I am not
very
happy about the fact that i've copied the content of the original
template
in my own template ad just added the <xsl:if ...>. Is there any way to 
prevent this, so don't have to check my templates every time a new
release
of the stylesheets are available?

Special Question:

This stuff works well with tags like para, table, imageobject, admons
and so on but if do this the same way for <chapter>, <sect1>, <sect2>
or other section-like tags, I get corrupt output!! Some of the chunked
files are missing!!! Does anybody knows what I am doing wrong here?
This is for example my custemized template for <chapter>

<xsl:template match="chapter">
  <xsl:if test="@arch='online' or not(@arch)">
  <xsl:variable name="id">
    <xsl:call-template name="object.id"/>
  </xsl:variable>

  <div id="{$id}" class="{name(.)}">
    <xsl:call-template name="component.separator"/>
    <xsl:call-template name="chapter.titlepage"/>
    <xsl:call-template name="component.toc"/>
    <xsl:apply-templates/>
    <xsl:call-template name="process.footnotes"/>
  </div>
  </xsl:if>
</xsl:template>

So what is the difference between these tags? How can I solve this
problem? Please help me!

Thank you,

Ali Saffari

-- 
------------------------------------------------------------------------------
PIRONET NDH
Dipl.-Ing. Ali Saffari - Junior Consultant - SBU Software
Josef-Lammerting-Allee 14-18 - 50933 Cologne - Germany
Tel.: +49 (0)221 770-1853 - Fax: +49 (0)221 770-1005
mailto:asaffari@pironet.com - http://www.pironet.com
------------------------------------------------------------------------------


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


Powered by eList eXpress LLC