[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Want to process XHTML in my XSL stylesheets.


Subject: Re: [xsl] Want to process XHTML in my XSL stylesheets.
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 8 Jul 2002 21:26:18 +0100

Hi Ed,

>> > Second question: How do I get the XHTML embedded in the XSL
>> > stylesheet to come out as HTML. All the examples I have seen are
>> > addressing XHMTL embedded in the input XML being transformed, not in
>> > the XSL stylesheet specifying the transformations.
>>
>> Set the output method to 'html' explicitly using the xsl:output
>> element at the top level of the stylesheet.
>>
>> <xsl:output method="html" />
>
> I've been doing this and my HTML elements/tags are still coming out
> with the namespace prefix I've been using for the XHTML
> elments/tags. This leads me to believe that either (a) I'm doing
> something else I shouldn't or not doing something I should or (b)
> the XSL processor I'm using is not explicilty processing XHTML
> elements.

When you use literal result elements in a particular namespace (e.g.
the XHTML namespace) to create elements then the elements you create
are in that namespace. I suppose that, if the XHTML namespace were
associated with the prefix 'html' and you didn't have a default
namespace declaration, you could use xsl:namespace-alias to move the
elements into no namespace:

<xsl:namespace-alias stylesheet-prefix="html"
                     result-prefix="#default" />

but that's unlikely to meet your requirements for other reasons (the
elements in the result will likely retain the prefix 'html').

So you can either stop using the XHTML namespace for your elements,
or, as you suggested, you can run a second transformation in the
result that transforms the XHTML elements into HTML (no namespace)
elements.
                     
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords