[jsword-devel] Next version of iPhone-ish site
DM Smith
dmsmith555 at yahoo.com
Thu Apr 24 05:44:54 MST 2008
Greg Hellings wrote:
>
> Maybe someone can give me a pointer as to how I would have all the
> verses and all of the footnotes grouped together? Currently the
> layout runs:
> verse 1
> notes 1
> verse 2
> notes 2
>
> I'm sure it's just a matter of moving around some calls in the .xsl,
> but I'm not certain which ones to move around at the moment.
>
The current simple.xsl has a match="/" template that goes through the
document twice, once in normal mode and once in "print-notes" mode, with
the output of each in a column of a table.
To do what you are asking you want to change this.
One way would be to process each verse, one at a time with the
stylesheet. The change then would be trivial. Rather than table cells
you'd just do the normal mode and then the print-notes mode.
But that is relatively expensive to run.
The better way would be to change the verse template to be something like:
(Note: the addition of <xsl:apply-templates select="." mode="print-notes"/>)
<xsl:template match="verse[not(@eID)]">
.....
<!-- Always output the verse -->
<xsl:choose>
<xsl:when test="$VLine = 'true'">
<div class="l"><a name="{@osisID}"><xsl:call-template
name="versenum"/></a><xsl:apply-templates/></div>
<xsl:apply-templates select="." mode="print-notes"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="versenum"/><xsl:apply-templates/>
<!-- Follow the verse with an extra space -->
<!-- when they don't start on lines to themselves -->
<xsl:text> </xsl:text>
<xsl:apply-templates select="." mode="print-notes"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Since the notes are in the immediate context of the verse, the reference
does not need to be a link. So the following templates should be changed:
<xsl:template match="note">
<xsl:if test="$Notes = 'true'">
<!-- If there is a following sibling that is a note, emit a
separator -->
<xsl:variable name="siblings" select="../child::node()"/>
<xsl:variable name="next-position" select="position() + 1"/>
<xsl:choose>
<xsl:when test="name($siblings[$next-position]) = 'note'">
<sup class="note"><xsl:call-template
name="generateNoteXref"/>, </sup>
</xsl:when>
<xsl:otherwise>
<sup class="note"><xsl:call-template
name="generateNoteXref"/></sup>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template match="note" mode="print-notes">
<div class="margin">
<strong><xsl:call-template name="generateNoteXref"/></strong>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="verse" mode="print-notes">
<xsl:if test=".//note[not(@type) or not(@type = 'x-strongsMarkup')]">
<xsl:apply-templates select=".//note" mode="print-notes" />
<div><xsl:text> </xsl:text></div>
</xsl:if>
</xsl:template>
Note: the mode="jesus" versions of these templates needs to be
maintained in parallel.
This is all off the top of my head, so there may be more too it than
just this.
In Him,
DM
More information about the jsword-devel
mailing list