Re: [xsl] Specifying the XHTML XMLNS

Subject: Re: [xsl] Specifying the XHTML XMLNS
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 28 Sep 2005 16:03:27 +0100
> Of course not. I have posted the "original" stylesheet that didn't
> include the xmlns declaration. If I make the change you suggest, the
> XSLT becomes (the same but with an extra xmlns declaration in
> xsl:stylesheet tag):

well not really, I meant that the result you posted was not generated by
your stylesheet _after_ you had added the xmlns declaration.

You said that it had xmlns on this link element:

  <link rel="stylesheet" href="./css/login.css" type="text/css" xmlns=""></link>

But  in this message when you post the entire result, note that link
does not have xmlns.

Note that the script element generated in the stylesheet also doesn't
have xmlns="" either.

Presumably the script that does have this has been copied from the
source. If you have a source element script-in-no-namespace and want to
generate script-in-html this (to xslt) is just like saying you have an
element <a> and want to generate <b>. You can do it but it is _not_ a
copy so you don't want

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>


You probably want a default template that renames elements, giving thenm
the same name but the xhtml namespace, which would be

  <xsl:template match="node()">
    <xsl:element name="{local-name()}">
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates/>
    </xsl:element>
  </xsl:template>

which will make elements in the xhtml namespace if that is the current
default.

David



________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread