|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Combining translate() and apply-templates
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








