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: "N David Brown" <orieldave@xxxxxxxxxxxxxx>
Date: Thu, 31 May 2007 14:46:38 +0100
Thanks loads for all that info, guys; I appreciate it very much.

You can just put the example in the filesystem and open it in Firefox.

Atm I'm in a GNU Screen session via a reverse SSH tunnel, connected to my home PC - my connection's being slow for some reason, so editing remotely is slow; also, I should be doing some 'work' at work, lol. So I'll get back to you guys later today once I've tested each of your suggestions at home =)

Thanks again.

- Dave

>
> One last question for David, before I test things when back at home.
> What you've written below produces 'ul' and 'li' elements in no
> namespace, according to what you said earlier. I'm assuming this
> means
> they will NOT be processed as XHTML elements, and hence will not
> produce the result I want (which is XHTML ul and li elements)?

For a browser it is more important that the DOCTYPE is correct. You
can set it in the <xsl:output /> instruction. However, it will not
effect the result when you use a doctype in an inlined stylesheet
(another difference from server side and client side rendering using
<?xml-stylesheet ?>)

In addition of being conformant XHTML, the elements may not have a
prefix and must be in the XHTML namespace. The previous example
changed such a way that it produces conformant XHTML when run from a
commandline processor, may look like this (place it in your
filesystem and point your firefox browser to it):

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="embedded.xslt"?>
<xsl:stylesheet
  xmlns="http://www.w3.org/1999/xhtml";
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  version="1.0" >

   <xsl:output method="html"
     doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
     doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>

   <xsl:template match="/">
       <html xml:lang="en" lang="en">
           <head><title>hello world</title></head>
           <body>
               <h1>Hello world!</h1>
           </body>
       </html>
   </xsl:template>
</xsl:stylesheet>


Cheers, -- Abel Braaksma

Current Thread