If you use XSLT 2.0, you could use the upper-case() function. (It's
actually an XPath 2.0 function.)
What is there about your problem that prevents the translate() function
from being sufficient? Please post your input and desired output.
If you want small-caps, I wrote an XSLT 1.0 solution to do that for HTML
some time ago. Here it is:
<xsl:template name="smallCaps">
<xsl:param name="inString"/>
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="plussigns" select="'++++++++++++++++++++++++++'"/>
<xsl:variable name="firstLetter" select="substring($inString, 1, 1)"/>
<xsl:variable name="upperFirst" select="upper-case($firstLetter)"/>
<xsl:choose>
<xsl:when test="$firstLetter = $upperFirst">
<xsl:variable name="lowerTest" select="translate($inString,
$lowercase, $plussigns)"/>
<xsl:choose>
<xsl:when test="contains($lowerTest, '+')">
<xsl:variable name="upperToRemove"
select="substring-before($lowerTest, '+')"/>
<span class="smallCapUpper"><xsl:value-of
select="$upperToRemove"/></span>
<xsl:call-template name="smallCaps">
<xsl:with-param name="inString"
select="substring-after($inString, $upperToRemove)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise> <!-- test="contains($lowerTest, '+')" -->
<span class="smallCapUpper"><xsl:value-of
select="$lowerTest"/></span>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise> <!-- test="$firstLetter = $upperFirst" -->
<xsl:variable name="upperTest" select="translate($inString,
$uppercase, $plussigns)"/>
<xsl:choose>
<xsl:when test="contains($upperTest, '+')">
<xsl:variable name="lowerToRemove"
select="substring-before($upperTest, '+')"/>
<span class="smallCapLower"><xsl:value-of
select="translate($lowerToRemove, $lowercase, $uppercase)"/></span>
<xsl:call-template name="smallCaps">
<xsl:with-param name="inString"
select="substring-after($inString, $lowerToRemove)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise> <!-- test="contains($upperTest, '+')" -->
<span class="smallCapLower"><xsl:value-of
select="translate($upperTest, $lowercase, $uppercase)"/></span>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Replace the span elements with fo:inline elements (with suitable font
specifications) to get a small-caps string in FO. By the way, a book
designer once told me that the small capitals in a small-caps string
should be 5/8 the size of the large capitals.
FWIW
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
"Willy Reinhardt" <[EMAIL PROTECTED]>
04/21/2005 03:17 AM
Please respond to
[email protected]
To
<[email protected]>
cc
Subject
How to transform a block or inline in uppercase
Hi,
I would set a text in uppercase I have no problem if I would use
small-caps but all characters in capitale with the same size I don't found
a clean solution (the solution xsl function translate isn't enough).
text-transform="uppercase" can't be use with block or inline and
font-variant hasn't value for full capitale.
How may I solve that issue with FOP ?
Thanks for any suggestions
Willy
-----------------------------------
Cambridge Technology and Partners
Willy Reinhardt
Air Center
Ch. des coquelicots 16
CH-1214 Vernier
Phone: +41 22 306 47 24
Fax: +41 22 306 47 47
http://www.ctp.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]