David said:
So, I want to do what should be a pretty straightforward. Figure
captions in my document can have footnote or link elements as well as
straight text. I would think that the following simple template would
produce the desired outcome but, instead, the original link and
footnote markup is included.
What am I doing wrong?!?
TIA,
David
==============
XSL code:
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/
Transform">
<xsl:template match="caption">
<p class="caption">
Figure <xsl:value-of select="@position"/>. <xsl:apply-templates/
<br /><br />
</p>
</xsl:template>
</xsl:stylesheet>
==============
Original Markup:
<caption position = "2">Designer illustrates that collection panels,
which contain the fields of a form under construction in the top of
this example, can use composed <footnote position='1'>A composed
Why is this < and not < (here and for the end-tag)?
view is one in which spatial relationships of the parts contribute to
the overall meaning.</footnote> views of objects.</caption>
==============
Current output example:
Figure 2. Designer illustrates that collection panels, which contain
the fields of a form under construction in the top of this example,
can use composed <footnote position='1'>A composed view is one in
which spatial relationships of the parts contribute to the overall
meaning.</footnote> views of objects.
Were you expecting the footnote element start-tag and end-tag to be
reproduced in the output automatically? That won't happen unless you
provide a template for the footnote element, even if all it does is
reproduce itself as it stands, eg
<xsl:template match="footnote">
<xsl:copy-of select="."/>
</xsl:template>
To make this work, your original must use proper elements, and not try
to fudge things with <
<caption position = "2">Designer illustrates that collection panels,
which contain the fields of a form under construction in the top of
this example, can use composed<footnote position='1'>A composed
view is one in which spatial relationships of the parts contribute to
the overall meaning.</footnote> views of objects.</caption>
Note particularly that the footnote start-tag *must* begin immediately
after the word to which it is attached, *with no space*, otherwise when
it comes to be rendered in the browser, the footnote mark (number or
symbol) will be separated from the words "can use composed" bu a space,
and if that falls at the end of the line, your readers may see the
footnote mark at the start of the next line.
However, if you want the footnote to be formatted in the browser as a
real footnote, you're going to have to make some decisions about how to
do that in an environment which is essentially pageless. In a table or
figure, it's easier, because the footnote doesn't get moved to the
bottom of the page, but only to the bottom of the figure.
To do this, your footnote template just outputs the footnote mark, for
example a superscripted letter; and you postpone the processing of the
footnote text itself until after the rest of the figure and caption.
Thus if your input document says:
<?xml version="1.0"?>
<figure image="foo.png">
<caption position = "2">Designer illustrates that collection panels,
which contain the fields of a form under construction in the top
of this example, can use composed<footnote position='1'>A composed
view is one in which spatial relationships of the parts
contribute to the overall meaning.</footnote> views of
objects.</caption>
</figure>
you could use the following XSLT:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl
utput method="html"/>
<xsl:template match="/">
<html>
<head>
<title></title>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="figure">
<div class="figure">
<img src="{@image}" alt="whatever"/>
<xsl:apply-templates/>
<xsl:if test="descendant::footnote">
<hr width="1in"/>
<ul>
<xsl:for-each select="descendant::footnote">
<li type="a">
<xsl:apply-templates/>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="caption">
<p class="caption">
<xsl:text>Figure </xsl:text>
<xsl:number format="1" count="//figure"/>
<xsl:text>. </xsl:text>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="footnote">
<sup>
<xsl:number format="a"/>
</sup>
</xsl:template>
</xsl:stylesheet>
This produces:
<html>
<head>
<title></title>
</head>
<body>
<div class="figure">
<img src="foo.png" alt="whatever">
<p class="caption">Figure 1. Designer illustrates that
collection panels, which contain the fields of a form
under construction in the top of this example, can use
composed<sup>a</sup> views of objects.</p>
<hr width="1in">
<ul>
<li type="a">A composed view is one in which spatial
relationships of the parts contribute to the overall
meaning.</li>
</ul>
</div>
</body>
</html>
General footnotes can be handled using a similar method in order to
place footnotes at the end of the chapter/section/subsection in which
they occur (as HTML has no real "pages"). For an example, see the
footnotes in the HTML version of my book _Formatting Information_ at
http://research.silmaril.ie/latex
///Peter