<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template name="smallcaps">
		<xsl:param name="str"/>
		<fo:inline font-size="85%">
			<xsl:call-template name="smallcapswork">
				<xsl:with-param name="str" select="$str"/>
			</xsl:call-template>
		</fo:inline>
	</xsl:template>
	<xsl:template name="smallcapswork">
		<xsl:param name="str"/>
		<xsl:param name="pos" select="'1'"/>
		<xsl:variable name="c" select="substring($str,$pos,1)"/>
		<xsl:if test="not(string-length($str) &lt; $pos)">
			<xsl:choose>
				<xsl:when test="$pos='1'">
					<fo:inline font-size="118%">
						<xsl:value-of select="$c"/>
					</fo:inline>
				</xsl:when>
				<xsl:when test="substring($str,($pos)-1,1)=' '">
					<fo:inline font-size="118%">
						<xsl:value-of select="$c"/>
					</fo:inline>
				</xsl:when>
				<xsl:when test="$c='0' or $c='1' or $c='2' or $c='3' or $c='4' or $c='5' or $c='6' or $c='7' or $c='8' or $c='9' or $c='(' or $c=')' or $c='[' or $c=']' or $c='{' or $c='}'">
					<fo:inline font-size="118%">
						<xsl:value-of select="$c"/>
					</fo:inline>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="translate($c,'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
				</xsl:otherwise>
			</xsl:choose>
			<xsl:call-template name="smallcapswork">
				<xsl:with-param name="str" select="$str"/>
				<xsl:with-param name="pos" select="($pos)+1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>

