xsl-list
[Top] [All Lists]

Re: XSL Transformation Question

2004-02-20 13:08:22
Eric,

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).

Cheers,
Wendell



___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_
    "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:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>