RE: [xsl] href problem...using CDATA needed?

Subject: RE: [xsl] href problem...using CDATA needed?
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Mon, 16 Jun 2003 10:46:30 -0400
[Wendell Piez]

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

I would go part of the way with Wendell here.  My hyperlinks usually
need just two things -

1) A simple text label
2) Attributes in the anchor element,  the href of course, and sometimes
a target and a title attribute as well.

For attribute values, I like using attribute value templates because
they are easy to read and write.  For the text label, I like to use
value of because using an additional template is harder to read (because
it has more surrounding boilerplate and because it is in another place).

 As an intermediate approach, when an attribute value would be more
complex, I sometimes use a variable, then insert the variable using an
{AVT}.  But that is my limit - if I have to get more complicated with
the anchor, I fully agree with Wendell that it is well to create a
template for the purpose.


Tom P

 XSL-List info and archive:

Current Thread