Re: [xsl] translation() function?

Subject: Re: [xsl] translation() function?
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Sun, 11 Nov 2007 15:08:02 +0530
Probably you need something like:

<xsl:template match="p">
   <xsl:apply-templates />

 <xsl:template match="emph">
     <xsl:call-template name="rend"/>

 <xsl:template match="text()">
   <xsl:value-of select="upper-case(.)"/>

 <xsl:template name="rend">
   <!-- some processing -->

On 11/11/07, Alice Ju-Hsuan Wei <ajwei@xxxxxxxxxxx> wrote:
> Hi,
>   I wanted to generate a whole chunk of text from a mixture of upper
> and lower case letters to all upper case. The problem is that my
> original text has also child elements. Here is an example:
> XML:
> <p><emph rend="bold">Upper and lower case transformations</emph> are
> very easy in XSLT thanks to the translate function. An alternative
> solution could be to implement the transformation and switch character
> by character, but since <emph rend="bold">XSLT</emph> already gives us
> a <emph rend="red bold">better</emph> solution, let's better take
> advantage of it. </p>
> <xsl:template match="p">
>  <xsl:value-of select="upper-case(.)"/>
> </xsl:template>
>  <xsl:template match="emph">
>        <span>
>            <xsl:call-template name="rend"/>
>            <xsl:apply-templates/>
>        </span>
>    </xsl:template>
> This code does output the upper case letters, but leaves out all other
> templates that associate with the additional formatting. I tried using
> <xsl:apply-templates/> inside the template, but then the text are no
> longer in upper case.
> Any ideas, anyone?
> Thanks in advance.
> Alice

Mukul Gandhi

Current Thread