[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] translation() function?


Subject: [xsl] translation() function?
From: Alice Ju-Hsuan Wei <ajwei@xxxxxxxxxxx>
Date: Sun, 11 Nov 2007 00:58:46 -0500

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>

XSLT:

<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


Current Thread
Keywords