Re: [xsl] xsl:element will not create an output element, in any context

Subject: Re: [xsl] xsl:element will not create an output element, in any context
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 31 May 2007 13:31:26 +0100
           <xsl:element name="xhtml:UL>

    <xsl:template match="*">
           <xsl:element name="xhtml:UL>

That generates an element ul in no namespace and an element xhtml:UL in
(presumably) the XHTML namespace.

XHTML doesn't have elements with either of those names, for xhtml,
elements have to be in the xhtml namespace, and have to have lower case

If you are generatig html rather than XHTML then the <ul> would be OK
but the <xhml:UL> would be an unknown element and so ignored.
So whether you are generating XHTML or HTML, the output of this is not
going to render as a list. HTML browsers don't give errors on invalid
html elemenst they just carry on ignore the unknown elements.

There is nothing magical about XSLT output, If you serve a document that
you hand write that looks like


to firefox you will get the same behaviour.

I repeat the advice I gave before, first decide what (X)HTML you want to
generate, and test that in the browser, only then start to look how you
can generate that markup using XSLT.

> I get the text nodes output (eg. rootmenudir1file1file2) with no ul
> tags surrounding. 

you wouldn't expect to see tags as firefox  doesn't lineraise the
result tree as an XML file, it renders it as html, and as this is invalid
html the most likely result is that you just see the character data.


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 

Current Thread