Subject: Re: [xsl] xsl:element will not create an output element, in any context From: "N David Brown" <orieldave@xxxxxxxxxxxxxx> Date: Thu, 31 May 2007 14:02:13 +0100 |
I know for certain what XHTML output I want; I have already done as you advised. I spent quite some time creating a slick JS slide open/close side menu that is simply nested unordered lists representing part of the local filesystem (hence the 'root', 'dir' and 'file' elements in my XML).
root -- <ul> ... </ul> dir -- <li> dirname <ul> ... </ul> </li> file -- <li> filename </li>
I've already tried both lc and uc for xhtml:ul - I just tested 'xhtml:ul' vs 'xhtml:UL', and the output is the same, regardless; still no elements produced.
<xsl:element name="xhtml:UL>
<xsl:template match="*"> <ul> <xsl:element name="xhtml:UL> <xsl:apply-templates/> </xsl:element> </ul> </xsl:template>
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 names.
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
<ul> <xhtml:UL>hhhh
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.
David
________________________________________________________________________ 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl:element will not crea, N David Brown | Thread | Re: [xsl] xsl:element will not crea, David Carlisle |
Re: [xsl] xsl:element will not crea, Abel Braaksma (onlin | Date | Re: [xsl] xsl:element will not crea, N David Brown |
Month |