Re: [xsl] xsl: help (urgent)

Subject: Re: [xsl] xsl: help (urgent)
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 10 Apr 2001 10:34:54 +0100
Hi Peter,

>>The best thing that you can do is to have the DESCRIPTION element
>>hold HTML rather than a string.
> Why not just add a template for the "a" element?

>   <xsl:template match="a">
>     <a href="{@href}">
>       <xsl:apply-templates/>
>     </a>
>   </xsl:template>
> (or a more complex one to handle name as well as or instead of href).

If the HTML was held as HTML, then yes, you could do that, although
simply copying all the nodes within the DESCRIPTION element would
probably be quicker and easier than recursively copying down the tree.

(And if you *do* copy recursively, then it's better to copy attributes
rather than create them with those values; the identity template is
the best method.)

But in Reghu's case, the 'HTML' was a string that happened to look
like a serialisation of HTML rather than actually being HTML - there
were no elements in it to match.  So there's no way a template could
have picked up on the 'a element' in it.

I hope that helps,


Jeni Tennison

 XSL-List info and archive:

Current Thread