html.xsl revision b7b3763e47df6eb4445f465b178c93fccff0adbf
db878466c5e95073429dda0bdd001f45e9486e16fielding Licensed to the Apache Software Foundation (ASF) under one or more
db878466c5e95073429dda0bdd001f45e9486e16fielding contributor license agreements. See the NOTICE file distributed with
db878466c5e95073429dda0bdd001f45e9486e16fielding this work for additional information regarding copyright ownership.
db878466c5e95073429dda0bdd001f45e9486e16fielding The ASF licenses this file to You under the Apache License, Version 2.0
db878466c5e95073429dda0bdd001f45e9486e16fielding (the "License"); you may not use this file except in compliance with
db878466c5e95073429dda0bdd001f45e9486e16fielding the License. You may obtain a copy of the License at
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end Unless required by applicable law or agreed to in writing, software
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end distributed under the License is distributed on an "AS IS" BASIS,
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end See the License for the specific language governing permissions and
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end limitations under the License.
f0528cfc93da36692a5fb7898d7e4a9e95150318nd<!-- load utility snippets -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- ==================================================================== -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- Ordinary HTML that must be converted to latex -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- ==================================================================== -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- Latex doesn't like successive line breaks, so replace any
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive sequence of two or more br separated only by white-space with
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive one line break followed by smallskips. -->
58842e03db54033d15cc224d997f467abc88a97aslive<xsl:when test="name(preceding-sibling::node()[1])='br' or name(preceding-sibling::node()[1])='indent'">
58842e03db54033d15cc224d997f467abc88a97aslive<xsl:when test="name(preceding-sibling::node()[2])='br' or name(preceding-sibling::node()[2])='indent'">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:when test="normalize-space(preceding-sibling::node()[1])=''">
5e9423b4ca454c6416a2dc465dea1b1d34cec7a9slive <!-- Don't put a line break if we are the last thing -->
5e9423b4ca454c6416a2dc465dea1b1d34cec7a9slive <xsl:if test="not(position()=last()) and not(position()=last()-1 and normalize-space(following-sibling::node()[1])='')">
5e9423b4ca454c6416a2dc465dea1b1d34cec7a9slive <!-- Don't put a line break if we are the last thing -->
5e9423b4ca454c6416a2dc465dea1b1d34cec7a9slive <xsl:if test="not(position()=last()) and not(position()=last()-1 and normalize-space(following-sibling::node()[1])='')">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- Value-of used here explicitly because we don't wan't latex-escaping
3fa58e00171aebf3b2cfa90035ed530f5b1f651dsliveperformed. Of course, this will conflict with html where some tags are
3fa58e00171aebf3b2cfa90035ed530f5b1f651dsliveinterpreted in pre -->
b7b3763e47df6eb4445f465b178c93fccff0adbfnd<!-- If it's a one-liner, trim the initial indentation as well -->
b7b3763e47df6eb4445f465b178c93fccff0adbfnd<!-- it's most likely an accident -->
39926890ef5576499f1bd78a1412b43e79f2f694slive<!-- XXX: We need to deal with table headers -->
368bcafaedaee463f769c1b5f3547b9970df90d0slive <xsl:when test="count(tr) > 15">longtable</xsl:when>
368bcafaedaee463f769c1b5f3547b9970df90d0slive<xsl:text>\begin{</xsl:text><xsl:value-of select="$table-type"/>
87ea898bcffe2ef490e833dc246a1cc0465d783fslive <xsl:if test="../../@border and not(position()=last())">
87ea898bcffe2ef490e833dc246a1cc0465d783fslive <xsl:if test="../../@border and not(position()=last())">
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:value-of select="/columnspec/column[$pos]/@width"/>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:value-of select="/columnspec/column[$pos]/@width"/>
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive This is a horrible hack, but it seems to mostly work. It does a
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive few things:
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive 1. Transforms references starting in http:// to footnotes with the
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive appropriate hyperref macro to make them clickable. (This needs
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive to be expanded to deal with news: and needs to be adjusted to
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive deal with "#", which is creating bad links at the moment.)
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive 2. For intra-document references, constructs the appropriate absolute
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive reference using a latex \pageref.
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive This involves applying a simplified version of the
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive general URL resolution rules to deal with ../. It only works for
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive one level of subdirectory.
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive 3. It is also necessary to deal with the fact that index pages
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive get references as "/".
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:variable name="relpath" select="document(/*/@metafile)/metafile/relpath" />
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:variable name="path" select="document(/*/@metafile)/metafile/path" />
16e03b5486a143424f332b912df99c0ef6e10130nd <xsl:value-of select="substring-before($href, '.html')"/>
05bc0ffcc324385e6110d3f3fd0e17e172378343nd<xsl:when test="starts-with(@href, 'http:') or starts-with(@href, 'https:') or starts-with(@href, 'ftp:') or starts-with(@href, 'news:') or starts-with(@href, 'mailto:')">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- Don't do inter-section references -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:value-of select="substring-after($fileref,'..')"/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:variable name="path" select="document(/*/@metafile)/metafile/path" />
0097a4f3e468c0192a2ce52ffee7bc8cea0a620bslive <xsl:with-param name="text" select="concat('.',$path,@src)"/>