This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [docbook-apps] Create caps presentation of phrase?


Depending on how sophisticated your target environments are, both XSL-FO and
CSS have the text-transform property that does this.  I know FOP doesn't
support this, but XEP does.  I'm not sure how widely supported the CSS
property is, though.

For FO:

 <fo:inline text-transform="uppercase"><xsl:value-of
select="."/></fo:inline>

For CSS:
 <span style="text-transform: uppercase"><xsl:value-of select="."/></span>


This *may* have less language-specific issues.  (i.e. You won't have to add
letters to the already lengthy transform arguments to support letters
outside of the English alphabet.)  If you're using Saxon or Xalan, you may
want to use their extension capabilites that allow you access to the
java.lang.String toUpper() method.

Jeff

> -----Original Message-----
> From: Bob Stayton [mailto:bobs at sco dot com]
> Sent: Wednesday, April 02, 2003 3:12 PM
> To: Steinar Bang
> Cc: docbook-apps at lists dot oasis-open dot org
> Subject: Re: [docbook-apps] Create caps presentation of phrase?
> 
> 
> On Wed, Apr 02, 2003 at 09:35:24PM +0200, Steinar Bang wrote:
> > Platform: DocBook XML 4.2, DocBook XSL 1.69.1
> > 
> > Is it simple/possible to do something in the local XSL customization
> > layer, so that eg. <phrase role="caps">Some TeXt</phrase> can be
> > rendered as "SOME TEXT"?
> > 
> > It's a request from a DocBook user at work, that I don't know how to
> > answer. 
> 
> Sure, add this to your customization layer:
> 
> <xsl:template match="phrase[ at role='caps']//text()">
>    <xsl:value-of select="translate(., 'abcdefghijklmnopqrstuvwxyz',
> 	'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
> </xsl:template>
> 
> This template matches on any text nodes ( text() )
> that are ancestors ( // ) of <phrase role="caps">.
> It applies the XSL translate() function to
> the current node's text.  The translation converts
> the lowercase letters to uppercase letters.
> 
> -- 
> 
> Bob Stayton                                 400 Encinal Street
> Publications Architect                      Santa Cruz, CA  95060
> Technical Publications                      voice: (831) 427-7796
> The SCO Group                               fax:   (831) 429-1887
>                                             email: bobs at sco dot com
> 
---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe at lists dot oasis-open dot org
> For additional commands, e-mail: 
> docbook-apps-help at lists dot oasis-open dot org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe at lists dot oasis-open dot org
For additional commands, e-mail: docbook-apps-help at lists dot oasis-open dot org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]