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: problems running db2latex-0.6 with docbook-xsl-1.45using saxon-6.4.4


Hello all,

to get known to the newest possible XSL-stylesheet solutions for
DocBook-XML I experimented with db2latex-0.6 (checked out of sf.net CVS at
24/11/2001) in conjunction with docbook-xsl-1.45 using saxon-6.4.4. I had
to do quite a lot of customization to resolve incompatibilities between
the different versions of the stylesheets and wondered if this is really
the actual status especially concerning db2latex.

Attached (so linebreaks won't cripple it) to this email is the
XSLT-customization-hack I had to use to even get my document (an english
article containing some german quotes => l10n used) processed by the
XSLT-engine. Maybe some experts could comment on the used templates?
Shouldn't that all be built into an actual version of db2latex (assuming
it should go there and not into Norm's modular stylesheets where some of
the now missing templates vanished in newer versions)?

BTW, the command line I used was (I can provide a link to the
document source if someone is interested):
java -classpath \
d:/java/saxon644/saxon.jar;d:/usr/share/sgml/dbxsl145/extensions/saxon644.jar\
com.icl.saxon.StyleSheet ../src/phigs.xml ../src/phigs_latex_145_06.xsl \
>phigs.tex

Db2latex' scape-template is IMHO a bit unhandy to maintain especially if
all character escaping to LaTeX is done in there. I'd wish something like
Norm's gentext as a more general solution but don't know if this is
possible.

Bye,
Steffen.

-- 
  http://w3studi.informatik.uni-stuttgart.de/~maiersn/
mailto:Steffen.Maier@studserv.uni-stuttgart.de
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
  xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
  version='1.0'>

  <!-- for use with db2latex-0.6 using docbook-xsl-1.45 -->
  <xsl:import href="file:/d:/usr/share/sgml/dbxsl145/latex06/docbook.xsl"/>

  <xsl:param name="my.time.stamp">$Date: 2001/11/25 16:22:14 steffen$</xsl:param>
  
  <xsl:output method="text" encoding="ISO-8859-1" indent="yes"/>
  
  <xsl:variable name="latex.override">% -----------------------  Define your Preamble Here 
\documentclass[english,a4]{book}
\usepackage{amsmath,amsthm, amsfonts, amssymb, amsxtra,amsopn}
\usepackage{graphicx}
\usepackage{float}
\usepackage{times}
%%\usepackage{algorithmic}
\usepackage[dvips]{hyperref}
\DeclareGraphicsExtensions{.eps}
% ------------------------  End of you preamble.
  </xsl:variable>

  <!-- resolve incompatibilities between db2latex-0.6 and docbook-xsl-1.45 -->

  <!-- taken from: dbxsl145/fo/graphics.xsl -->
  <xsl:template name="is.graphic.extension">
    <xsl:param name="ext"></xsl:param>
    <xsl:if test="$ext = 'png'
                  or $ext = 'pdf'
                  or $ext = 'jpeg'
                  or $ext = 'jpg'
                  or $ext = 'gif'
                  or $ext = 'bmp'">1</xsl:if>
  </xsl:template>
  <xsl:template name="is.graphic.format">
    <xsl:param name="format"></xsl:param>
    <xsl:if test="$format = 'PNG'
                  or $format = 'PDF'
                  or $format = 'JPG'
                  or $format = 'JPEG'
                  or $format = 'linespecific'
                  or $format = 'GIF'
                  or $format = 'GIF87a'
                  or $format = 'GIF89a'
                  or $format = 'BMP'">1</xsl:if>
  </xsl:template>

  <!-- taken from within a comment in: dbxsl145/common/common.xsl -->
  <!-- those templates were still in use in dbxsl134 but no more in 145 -->
  <xsl:template name="xref.g.subst">
    <xsl:param name="string"></xsl:param>
    <xsl:param name="target" select="."/>
    <xsl:variable name="subst">%g</xsl:variable>
    
    <xsl:choose>
      <xsl:when test="contains($string, $subst)">
        <xsl:value-of select="substring-before($string, $subst)"/>
        <xsl:call-template name="gentext.element.name">
          <xsl:with-param name="element.name" select="name($target)"/>
        </xsl:call-template>
        <xsl:call-template name="xref.g.subst">
          <xsl:with-param name="string"
            select="substring-after($string, $subst)"/>
          <xsl:with-param name="target" select="$target"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$string"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template name="xref.t.subst">
    <xsl:param name="string"></xsl:param>
    <xsl:param name="target" select="."/>
    <xsl:variable name="subst">%t</xsl:variable>
    
    <xsl:choose>
      <xsl:when test="contains($string, $subst)">
        <xsl:call-template name="xref.g.subst">
          <xsl:with-param name="string"
            select="substring-before($string, $subst)"/>
          <xsl:with-param name="target" select="$target"/>
        </xsl:call-template>
        <xsl:call-template name="title.xref">
          <xsl:with-param name="target" select="$target"/>
        </xsl:call-template>
        <xsl:call-template name="xref.t.subst">
          <xsl:with-param name="string"
            select="substring-after($string, $subst)"/>
          <xsl:with-param name="target" select="$target"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:call-template name="xref.g.subst">
          <xsl:with-param name="string" select="$string"/>
          <xsl:with-param name="target" select="$target"/>
        </xsl:call-template>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template name="xref.n.subst">
    <xsl:param name="string"></xsl:param>
    <xsl:param name="target" select="."/>
    <xsl:variable name="subst">%n</xsl:variable>
    
    <xsl:choose>
      <xsl:when test="contains($string, $subst)">
        <xsl:call-template name="xref.t.subst">
          <xsl:with-param name="string"
            select="substring-before($string, $subst)"/>
          <xsl:with-param name="target" select="$target"/>
        </xsl:call-template>
        <xsl:call-template name="number.xref">
          <xsl:with-param name="target" select="$target"/>
        </xsl:call-template>
        <xsl:call-template name="xref.t.subst">
          <xsl:with-param name="string"
            select="substring-after($string, $subst)"/>
          <xsl:with-param name="target" select="$target"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:call-template name="xref.t.subst">
          <xsl:with-param name="string" select="$string"/>
          <xsl:with-param name="target" select="$target"/>
        </xsl:call-template>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template name="subst.xref.text">
    <xsl:param name="xref.text"></xsl:param>
    <xsl:param name="target" select="."/>
    
    <xsl:call-template name="xref.n.subst">
      <xsl:with-param name="string" select="$xref.text"/>
      <xsl:with-param name="target" select="$target"/>
    </xsl:call-template>
  </xsl:template>

  <!-- taken from db2latex051/latex/normalize-scape.mod.xsl -->
  <!-- overwritten partly because of my corrections of gentext/de.xml -->
  <xsl:template name="scape" >
    <xsl:param name="string"/>
    <xsl:call-template name="string-replace">
      <xsl:with-param name="to">$\backslash$</xsl:with-param>
      <xsl:with-param name="from">\</xsl:with-param>
      <xsl:with-param name="string">
        <xsl:call-template name="string-replace">
          <xsl:with-param name="to">$&lt;$</xsl:with-param>
          <xsl:with-param name="from">&lt;</xsl:with-param>
          <xsl:with-param name="string">
            <xsl:call-template name="string-replace">
              <xsl:with-param name="to">$&gt;$</xsl:with-param>
              <xsl:with-param name="from">&gt;</xsl:with-param>
              <xsl:with-param name="string">
                <xsl:call-template name="string-replace">
                  <xsl:with-param name="to">\{</xsl:with-param>
                  <xsl:with-param name="from">{</xsl:with-param>
                  <xsl:with-param name="string">
                    <xsl:call-template name="string-replace">
                      <xsl:with-param name="to">\}</xsl:with-param>
                      <xsl:with-param name="from">}</xsl:with-param>
                      <xsl:with-param name="string">
                        <xsl:call-template name="string-replace">
                          <xsl:with-param name="to">\&amp;</xsl:with-param>
                          <xsl:with-param name="from">&amp;</xsl:with-param>
                          <xsl:with-param name="string">
                            <xsl:call-template name="string-replace">
                              <xsl:with-param name="to">\#</xsl:with-param>
                              <xsl:with-param name="from">#</xsl:with-param>
                              <xsl:with-param name="string">
                                <xsl:call-template name="string-replace">
                                  <xsl:with-param name="to">\_</xsl:with-param>
                                  <xsl:with-param name="from">_</xsl:with-param>
                                  <xsl:with-param name="string">
                                    <xsl:call-template name="string-replace">
                                      <xsl:with-param name="to">\$</xsl:with-param>
                                      <xsl:with-param name="from">$</xsl:with-param>
                                      <xsl:with-param name="string">
                                        <xsl:call-template name="string-replace">
                                          <xsl:with-param name="to">\%</xsl:with-param>
                                          <xsl:with-param name="from">%</xsl:with-param>
                                          <xsl:with-param name="string">
                                            <xsl:call-template name="string-replace">
                                              <xsl:with-param name="to">---</xsl:with-param>
                                              <xsl:with-param name="from">&#8212;</xsl:with-param><!--&mdash;=&#8212;-->
                                              <xsl:with-param name="string">
                                                <xsl:call-template name="string-replace">
                                                  <xsl:with-param name="to">--</xsl:with-param>
                                                  <xsl:with-param name="from">&#8211;</xsl:with-param><!--&ndash;=&#8211;-->
                                                  <xsl:with-param name="string">
                                                    <xsl:call-template name="string-replace">
                                                      <xsl:with-param name="to">`"</xsl:with-param>
                                                      <xsl:with-param name="from">&#8218;</xsl:with-param><!--&sbquo;=&#8218;-->
                                                      <xsl:with-param name="string">
                                                        <xsl:call-template name="string-replace">
                                                          <xsl:with-param name="to">´"</xsl:with-param>
                                                          <xsl:with-param name="from">&#8220;</xsl:with-param><!--&ldquo;=&#8220;-->
                                                          <xsl:with-param name="string">
                                                            <xsl:call-template name="string-replace">
                                                              <xsl:with-param name="to">`</xsl:with-param>
                                                              <xsl:with-param name="from">&#8216;</xsl:with-param><!--lsquo=8216-->
                                                              <xsl:with-param name="string">
                                                                <xsl:call-template name="string-replace">
                                                                  <xsl:with-param name="to">´"</xsl:with-param>
                                                                  <xsl:with-param name="from">&#8217;</xsl:with-param><!--&rsquo;=&#8217;-->
                                                                  <xsl:with-param name="string" select="$string"></xsl:with-param>
                                                                </xsl:call-template>
                                                              </xsl:with-param>
                                                            </xsl:call-template>
                                                          </xsl:with-param>
                                                        </xsl:call-template>
                                                      </xsl:with-param>
                                                    </xsl:call-template>
                                                  </xsl:with-param>
                                                </xsl:call-template>
                                              </xsl:with-param>
                                            </xsl:call-template>
                                          </xsl:with-param>
                                        </xsl:call-template>
                                      </xsl:with-param>
                                    </xsl:call-template>
                                  </xsl:with-param>
                                </xsl:call-template>
                              </xsl:with-param>
                            </xsl:call-template>
                          </xsl:with-param>
                        </xsl:call-template>
                      </xsl:with-param>
                    </xsl:call-template>
                  </xsl:with-param>
                </xsl:call-template>
              </xsl:with-param>
            </xsl:call-template>
          </xsl:with-param>
        </xsl:call-template>
      </xsl:with-param>
    </xsl:call-template>
  </xsl:template>

  <!-- taken from: db2latex06/latex/normalize-scape.mod.xsl -->
  <!-- each and every text() has to be 'scaped', e.g. because of &mdash; -->
  <xsl:template match="text()">
    <xsl:call-template name="scape">
      <xsl:with-param name="string" select="."/>
    </xsl:call-template>
  </xsl:template>

  <!-- taken from: dblatex06/latex/inline.mod.xsl -->
  <xsl:template name="inline.italicseq">
    <xsl:param name="content">
      <xsl:apply-templates/>
    </xsl:param>
    <xsl:text> {\em </xsl:text>
    <!-- <xsl:copy-of select="$content"/> -->
    <xsl:apply-templates/> <!-- hopefully this uses text()-template with scape subproc -->
    <xsl:text> }</xsl:text>
  </xsl:template>

  <!-- taken from: dbxsl145/common/l10n.xsl -->
  <xsl:template name="gentext.dingbat">
    <xsl:param name="dingbat">bullet</xsl:param>
    <xsl:param name="lang">
      <xsl:call-template name="l10n.language"/>
    </xsl:param>
    
    <xsl:variable name="local.l10n.dingbat"
      select="($local.l10n.xml//l:i18n/l:l10n[@language=$lang]/l:dingbat[@key=$dingbat])[1]"/>
    
    <xsl:variable name="l10n.dingbat"
      select="($l10n.xml/l:i18n/l:l10n[@language=$lang]/l:dingbat[@key=$dingbat])[1]"/>
    
    <xsl:choose>
      <xsl:when test="count($local.l10n.dingbat) &gt; 0">
        <xsl:value-of select="$local.l10n.dingbat/@text"/>
      </xsl:when>
      <xsl:when test="count($l10n.dingbat) &gt; 0">
        <!-- <xsl:value-of select="$l10n.dingbat/@text"/> -->
        <xsl:call-template name="scape"> <!-- hopefully this substitutes invalid output chars -->
          <xsl:with-param name="string" select="$l10n.dingbat/@text"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:message>
          <xsl:text>No "</xsl:text>
          <xsl:value-of select="$lang"/>
          <xsl:text>" localization of dingbat </xsl:text>
          <xsl:value-of select="$dingbat"/>
          <xsl:text> exists; using "en".</xsl:text>
        </xsl:message>
        
        <xsl:value-of select="($l10n.xml/l:i18n/l:l10n[@language='en']/l:dingbat[@key=$dingbat])[1]/@text"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  
                  
</xsl:stylesheet>
  
<!--
Local variables:
mode: xsl
time-stamp-start: "\\$Date: \\\\?"
time-stamp-end: "\\\\?\\$"
time-stamp-format: "%:y/%02m/%02d %02H:%02M:%02S %u"
sgml-omittag:nil
sgml-shorttag:nil
sgml-namecase-general:nil
sgml-general-insert-case:lower
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:nil
sgml-parent-document:nil
End:
-->


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


Powered by eList eXpress LLC