Re: [xslt] Transforming RSS (")

On Mon, 2005-12-12 at 10:28 -0700, Andrew Shafer wrote:
> A problem is people often put &quot; into the <description> tag, so at
> the end of the day the result is &amp;quot;.
> Is there a common/best way to fix this?

The best fix is to tell them not to do this.

With XSLT 2 you can use analyze-string or substutute(),
but with XSLT 1 you can do a (recursive) loop with
contains() to look for the string to replace.

A recursive template might take two parameters,
input and input-processed, as well as
$string (the thing to replace) and $replacement

    when $input is empty
    return $input-processed

    when $input contains $string
    call self with
       input-processed = concat(substring-before($string), $replacement)
       input = substring-after($string)

    return concat($input-processed, $input)


Liam Quin, W3C XML Activity Lead,
Pictures from old books:
IRC (chat) programs:

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]