xsl-list
[Top] [All Lists]

Re: [xsl] translation() function?

2007-11-11 02:38:36
Probably you need something like:

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

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

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

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


On 11/11/07, Alice Ju-Hsuan Wei <ajwei(_at_)indiana(_dot_)edu> 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>

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


-- 
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>