RE: Replace case insensitive

sorry

Michael Kay-3 wrote:
> 
> 
> 
> This list is provided to allow people to make comments on the W3C XSL-FO
> and
> XSLT specifications. It is not a forum for obtaining programming advice.
> For
> that we recommend the xsl-list hosted at www.mulberrytech.com, where you
> will almost certainly get a good answer to your question. If you are
> constrained to use XSLT 1.0, do make this clear in your posting, as many
> people are now using XSLT 2.0 which makes this kind of problem much
> easier.
> 
> Michael Kay
> http://www.saxonica.com/ 
> 
>> -----Original Message-----
>> From: xsl-editors-request@w3.org 
>> [mailto:xsl-editors-request@w3.org] On Behalf Of axdmoraes
>> Sent: 15 October 2007 19:48
>> To: xsl-editors@w3.org
>> Subject: Replace case insensitive
>> 
>> 
>> 
>> Hi,
>> 
>>      I need to find some word in the xml and put a tag <high> 
>> around it. I did it using the Dave Pawson´s search and 
>> replace acronym´s
>> method.(http://www.dpawson.co.uk/xsl/sect2/replace.html#d9478e115)
>> Now i need that this works in case-insensitive.  Can anyone help me?
>> 
>> 
>> Here is my code...
>> 
>> <xsl:stylesheet version="1.0"
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>>  <xsl:output method="xml" omit-xml-declaration="yes"/>
>>  <xsl:param name="palavra"/>
>> 
>>  <xsl:template match="/">
>>   <xsl:apply-templates/>
>>  </xsl:template>
>>  <xsl:template match="@*|*">
>>   <xsl:copy>
>>    <xsl:apply-templates select="@*|node()"/>
>>   </xsl:copy>
>>  </xsl:template>
>>  <xsl:template match="text()">
>>   <xsl:call-template name="globalreplace">
>>    <xsl:with-param name="toreplace" 
>> select="$palavra"/>
>>    <xsl:with-param name="output" select="."/>
>>   </xsl:call-template>
>>  </xsl:template>
>>  
>>  <xsl:template name="globalreplace">
>>  <xsl:param name="toreplace"/>
>>  <xsl:param name="output"/>
>>  <xsl:variable name="outputlower">
>>   <xsl:value-of
>> select="translate($output,'ABCDEFGHIJKLMNOPQRSTUVXYZ','abcdefg
>> hijklmnopqrstuvxyz')"/>
>>  </xsl:variable>
>>   <xsl:choose>
>>    <xsl:when test="not(string($toreplace))">
>>     <xsl:value-of select="$output"/>
>>    </xsl:when>
>>    <xsl:when test="not(string($output))"/>
>>    <xsl:otherwise>
>>     <xsl:variable name="singlereplace">
>>     <xsl:choose>
>>      <xsl:when 
>> test="string-length(substring-before($toreplace,'|'))>0">
>>       <xsl:value-of 
>> select="substring-before($toreplace,'|')"/>
>>      </xsl:when>
>>      <xsl:otherwise>
>>       <xsl:value-of 
>> select="$toreplace"/>
>>      </xsl:otherwise>
>>     </xsl:choose>
>>     </xsl:variable>
>>     <xsl:choose>
>>      <xsl:when 
>> test="contains($outputlower, $singlereplace)">
>>       <xsl:variable 
>> name="before">
>>        
>> <xsl:value-of select="translate(substring-before($outputlower,
>> $singlereplace),$outputlower,$output)"/>
>>        <!--xsl:value-of
>> select="substring-before($output,$singlereplace)"/-->
>>       </xsl:variable> 
>>       <xsl:variable 
>> name="after">
>>        
>> <xsl:value-of select="translate(substring-after($outputlower,
>> $singlereplace),$outputlower,$output)"/>
>>        
>> <!--xsl:value-of select="substring-after($output,$singlereplace)"/-->
>>       </xsl:variable>
>>       
>> <xsl:call-template name="globalreplace">
>>        
>> <xsl:with-param name="output" select="$before"/>
>>        
>> <xsl:with-param name="toreplace"
>> select="substring-after($toreplace,'|')"/>
>>       </xsl:call-template>
>>       
>> <high><xsl:value-of select="$singlereplace"/></high>
>>       
>> <xsl:call-template name="globalreplace">
>>        
>> <xsl:with-param name="output" select="$after"/>
>>        
>> <xsl:with-param name="toreplace"
>> select="substring-after($toreplace,'|')"/>
>>       </xsl:call-template>
>>      </xsl:when>
>>      <xsl:otherwise>
>>       
>> <xsl:call-template name="globalreplace">
>>        
>> <xsl:with-param name="output" select="$output"/>
>>        
>> <xsl:with-param name="toreplace"
>> select="substring-after($toreplace,'|')"/>
>>       </xsl:call-template>
>>      </xsl:otherwise>
>>     </xsl:choose>
>>    </xsl:otherwise>
>>   </xsl:choose>
>>  </xsl:template>
>>  </xsl:stylesheet>
>> 
>> 
>> thanks,
>> 
>> Alexandre
>> --
>> View this message in context: 
>> http://www.nabble.com/Replace-case-insensitive-tf4629525.html#
>> a13219155
>> Sent from the w3.org - xsl-editors mailing list archive at Nabble.com.
>> 
>> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Replace-case-insensitive-tf4629525.html#a13254104
Sent from the w3.org - xsl-editors mailing list archive at Nabble.com.

Received on Wednesday, 17 October 2007 13:41:04 UTC