[xsl] Testing last character for bibliography output

Subject: [xsl] Testing last character for bibliography output
From: Charles Muller <acmuller@xxxxxxx>
Date: Sun, 13 Jul 2003 20:54:55 +0900 (JST)
I am transforming a bibliography into HTML using MLA, Chicago, etc. formats,
where I want to have a period after the author, book title, etc. Sometimes
my data comes with the period already attached, and sometimes not, so I need
a way of using xsl:if to test if the last character is a period or not. I
guess, then, that I am looking for something like a "lastchar" variable in
XSLT, but so far I have not been able to find any examples of this sort of
case in my XSLT books or on the web.

A sample piece of the XSLT file area, just for the entity <title>is like this:

 <xsl:template match="title">
    <xsl:choose>
    <xsl:when test="ancestor::listBibl">
<xsl:choose>
<xsl:when test="@level='m'">
    <span style="font-style:italic">
      <xsl:apply-templates/>. </span>
</xsl:when>
<xsl:when test="@level='j'">
    <span style="font-style:italic">
      <xsl:apply-templates/>. 
    </span> 
</xsl:when>
<xsl:when test="@level='a'">
&quot;<xsl:apply-templates/>.&quot;
  </xsl:when>
<xsl:when test="@level='u'">
&quot;<xsl:apply-templates/>.&quot;
  </xsl:when>


Charles Muller



---------------------------
Charles Muller  <acmuller@xxxxxxx>
Faculty of Humanities,  Toyo Gakuen University
Digital Dictionary of Buddhism and CJKV-English Dictionary [http://www.acmuller.net]
H-Buddhism List Editor [http://www.h-net.org/~buddhism/]
Mobile Phone: 090-9310-1787

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread