Re: [xsl] XSL Transformation Question

Subject: Re: [xsl] XSL Transformation Question
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 20 Feb 2004 15:08:22 -0500

At 02:05 PM 2/20/2004, you wrote:
I have a rss feed I am trying to transform, but it will not read the img and
a tags from within the description of each item

If you're referring to the pseudo-markup in your sample file (the markup-that-is-not-markup because it is escaped), you are looking at the Bane of RSS. This stuff is done this way so it won't be parsed. Not parsed, not XML -- your stylesheet can't do anything with it beyond treating it as a string.

There are extension functions in some processors that will take a string and parse it as XML -- Saxon has one -- but short of that you're kind of stuck; your options are (a) to pre-process the file into honest markup (running the risk that it won't be well-formed, but then that's the risk already) -- this can be done using the non-standard XSLT disable-output-escaping feature -- or (b) to implement an XML parser in XSLT.

Even though the XML Rec says that "It shall be easy to write programs which process XML documents", you really don't want to try (b).

I'd look for the extension function, and if I couldn't use that, I'd try (a). In any case, you'll need a strategy for dealing with feeds that break because their "markup" isn't well-formed (requiring very smart heuristics or manual intervention to fix).


"Thus I make my own use of the telegraph, without consulting
the directors, like the sparrows, which I perceive use it
extensively for a perch." -- Thoreau

XSL-List info and archive:

Current Thread