[Home] [By Thread] [By Date] [Recent Entries]
Cynthia,
Watch out though: David's cunning solution won't work in every case: At 02:33 PM 1/26/2005, you wrote: <xsl:variable name="title"> <xsl:apply-templates select="title"/> </xsl:variable> only works as long as your input title, when processed by applying templates, needs to generate *only* a text value. So if your input had <new_rel> <title>La <emph>Divorc<eacute />e</emph></title> <rating>R</rating> </new_rel> that <emph> element would be lost, even if you also had <xsl:template match="emph">
<b>
<xsl:apply-templates/>
</b>
</xsl:template>This is because when translate() operates on the variable $title it has to treat it as a string, so the result-tree-fragment created by applying templates to your title is "flattened" into its string value -- the <b> node generated by your template goes away. I'm afraid a truly general solution to your problem requires multiple passes. This is because your solution to the representing-odd-characters problem straddles the line between markup and text ... you want to represent it as markup (in XSLT terms, "nodes"), yet process it as text. Or you could constrain the input so that nothing like that emph will ever happen. Just thought it fair to warn.... Cheers, Wendell
|

Cart



