It is possible to use the translate() function, if one doesn't have to
worry about non-ASCII characters: e.g.,
   <xsl:variable name="titleText">
      <xsl:value-of select="//myTitle"/>
    </xsl:variable>
    <xsl:value-of select="translate
($titleText,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>

I think one could put Unicode characters in the translate() strings, but
then they could get quite long and very hard to generalize -- which is why
text-transform itself is deprecated. Even translate() isn't robustly
recommended. From the Xpath spec;

Function: string translate(string, string, string)


The translate function returns the first argument string with occurrences
of characters in the second argument string replaced by the character at
the corresponding position in the third argument string. For example,
translate("bar","abc","ABC") returns the string BAr. If there is a
character in the second argument string with no character at a
corresponding position in the third argument string (because the second
argument string is longer than the third argument string), then occurrences
of that character in the first argument string are removed. For example,
translate("--aaa--","abc-","ABC") returns "AAA". If a character occurs more
than once in the second argument string, then the first occurrence
determines the replacement character. If the third argument string is
longer than the second argument string, then excess characters are ignored.


      NOTE: The translate function is not a sufficient solution for case
      conversion in all languages. A future version of XPath may provide
      additional functions for case conversion.

Fred



                                                                                
                                                
                      "Andreas L.                                               
                                                
                      Delmelle"                To:       <[EMAIL PROTECTED]>    
                                          
                      <[EMAIL PROTECTED]        cc:                             
                                                 
                      dora.be>                 Subject:  RE: How to capitalize 
text ???                                         
                                                                                
                                                
                      02/12/2004 09:02                                          
                                                
                      AM                                                        
                                                
                      Please respond to                                         
                                                
                      fop-user                                                  
                                                
                                                                                
                                                
                                                                                
                                                




> -----Original Message-----
> From: Glen Mazza [mailto:[EMAIL PROTECTED]
>
> Of course, if you're only using the string in one place, or if you always
> want it capitalized, then you should be able to do the conversion in your
> database SQL to begin with:
>
> select upper(column_name) from table_name;
>

For the record:
If one is determined in leaving this up to the FO processor, this would
ultimately work as well in XSL-FO (just in case the SQL is out of your
control... and you're not working with FOP(*) --damn'! ;) ):

<!-- the following template will capitalize all text-nodes -->

<xsl:template match="text()">
  <fo:wrapper text-transform="uppercase">
    <xsl:value-of select="." />
  </fo:wrapper>
</xsl:template>


Cheers,

Andreas

(*) http://xml.apache.org/fop/compliance.html#fo-property-text-transform


---------------------------------------------------------------------
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]

Reply via email to