W3C home > Mailing lists > Public > www-xsl-fo@w3.org > July 2008

Antwort: case insensitivity

From: Olaf Wentzien <olaf.wentzien@ppi.de>
Date: Thu, 3 Jul 2008 09:02:34 +0200
To: www-xsl-fo@w3.org
Message-ID: <OF27248407.B2A4698E-ONC125747B.0023EA06-C125747B.0026B056@ppi.de>

Hi Saqib,

how about trying this:

     <xsl:when test="lower-case(F2) = 'starting balance' ">
         <xsl:value-of select="F2"/>
     </fo:inline>

or 

     <xsl:when test="upper-case(F2) = 'STARTING BALANCE' ">
         <xsl:value-of select="F2"/>
     </fo:inline>


??

Or did you mean a test that the string contains only upper or lowercase 
letters ?

Than you could do somthing like:

             <xsl:variable name="F2String" 
select="java:java.lang.String.new()" />

     <xsl:when test="java:lang.String.matches($F2String, '"[A-Z]*"')"
         <xsl:value-of select="F2"/>
     </fo:inline>

In this case your stylesheet should contain something like:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0"
    ...
    ...
    xmlns:java="http://xml.apache.org/xalan/java"
    exclude-result-prefixes="java">


so that you can use java from your stylesheet.

for further information on using java refer to 

http://www.cafeconleche.org/books/xmljava/chapters/ch17s03.html


Regards Olaf

www-xsl-fo-request@w3.org schrieb am 03.07.2008 06:52:02:

> Hello every one.
>  i want to use xsl:if for testing some string but discarding the 
> case sensitivity.
> the sample is 
>     <xsl:when test="F2 = 'Starting Balance' ">
>         <xsl:value-of select="F2"/>
>      </fo:inline>
> now i want to check it for lower case or upper case. I've already 
> gone through many codes but cannot understand its working. lower-
> case of xpath is also not working.
> Thanks
> Regards,
> Saqib javed
Received on Thursday, 3 July 2008 07:03:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 3 July 2008 07:03:19 GMT