$ saxon9 -it:m ct.xsl
<?xml version="1.0" encoding="UTF-8"?>
: A Memorandum of Understanding
: Where Did the Druids Come From
: Being for the Benefit of [Mr.] Kite
where ct.xsl is
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:l="data:,l"
>
<xsl:function name="l:tc" as="xs:string">
<xsl:param name="s"/>
<xsl:value-of>
<xsl:analyze-string select="lower-case($s)" regex="(\w)(\w*)">
<xsl:matching-substring>
<xsl:choose>
<xsl:when test="position()!=1 and .=('the','for','of')">
<xsl:sequence select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="concat(upper-case(regex-group(1)),regex-group(2))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:sequence select="."/>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:value-of>
</xsl:function>
<xsl:template name="m">
: <xsl:value-of select="l:tc('A MEMORANDUM OF UNDERSTANDING')"/>
: <xsl:value-of select="l:tc('WHERE DID THE DRUIDS COME FROM')"/>
: <xsl:value-of select="l:tc('BEING FOR THE BENEFIT OF [MR.] KITE')"/>
</xsl:template>
</xsl:stylesheet>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--