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

[xsl] Combining translate() and apply-templates


Subject: [xsl] Combining translate() and apply-templates
From: Cynthia DeLaria <cdelaria@xxxxxxxxxxxxx>
Date: Wed, 26 Jan 2005 11:04:55 -0700 (GMT-07:00)

Hello, all... :)

I have been searching for a solution to this for weeks, to no avail...

I have the following xml:

<new_rel>
  <title>New Title Here</title>
  <rating>PG</rating>
</new_rel>

In certain instances in my xsl, the title needs to be translated to all upper case:

<xsl:value-of select="translate(./title,$lower,$upper)" />

where $lower and $upper are defined at the top of the document.

The problem is that sometimes the title node includes templates for special characters (i.e. spanish language characters, tildas, etc). So sometimes the xml looks like this:

<new_rel>
  <title>L<eacute /> Divorce</title>
  <rating>PG</rating>
</new_rel>

where <eacute /> has a template that puts in an &eacute; character.

How can I apply the templates in the node and still have the value translate() to upper case? Something like this (although I am aware that this code is improper):

<xsl:apply-templates select="translate(./title,$lower,$upper)" />

Thanks!

Cynthia


Current Thread
Keywords