html.xsl revision 58842e03db54033d15cc224d997f467abc88a97a
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 -->
39926890ef5576499f1bd78a1412b43e79f2f694slive<!-- XXX: We need to deal with table headers -->
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" />
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:value-of select="substring-before(@href, '.html')"/>
39926890ef5576499f1bd78a1412b43e79f2f694slive<xsl:when test="starts-with(@href, 'http:') 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" />
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\includegraphics{</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:value-of select="concat('.',$path,@src)"/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>}</xsl:text>