xsl-list
[Top] [All Lists]

RE: href problem...using CDATA needed?

2003-06-13 14:06:20
At 04:24 PM 6/13/2003, TomP wrote:
In your template, it seems very unusual to have an apply-templates
instruction within the body of an anchor element.  An anchor is supposed
to contain only inline elements - it is not clear why you would need
apply-templates. If it is going to return structured information, an
anchor element is the wrong place for it.  If it is going to return a
bit of text like a label, chances are you can do it with just
xsl:value-of.

I disagree with Tom here. I prefer to use xsl:apply-templates by default all the way down, and only go to xsl:value-of (or something else) as the motivated exception.

This may because I deal a lot with messy documentary data that often includes lots of mixed content, including even mixed content in the midst of anchor tags and such like (they do happen). The graceful way XSLT's so-called "push" model deals with mixed content is among its greatest misunderstood and discounted strengths. (But then mixed content itself seems to be a deep mystery to some.)

There can also be stuff like images in there.

In fact, with newbies I like to slap their hands for using value-of without thinking about why. :->

(This is not to say that I don't trust Tom to do the right thing for his situation: I do.)

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