[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [xml] empty xmlns attributes
- From: Simone Piunno <pioppo ferrara linux it>
- To: xml gnome org
- Subject: Re: [xml] empty xmlns attributes
- Date: Tue, 11 Feb 2003 23:44:28 +0100
On Tue, Feb 11, 2003 at 10:24:26PM +0000, Peter McGarvey wrote:
> All I'm trying to do is take some xhtml-ish xml document, and apply a
> XSLT stylesheet to turn it into xhtml 1.1. It's working but the
> W3C validation keeps moaning about `xmlns=""' attributes. I just
> can't work out why these attribute appear in the final output, or how to
> get rid of them.
This is the exact same problem that was affecting my docbook site a
couple of days ago.
> I'm using
> libxml2-2.5.2
> libxslt-1.0.25
same for me.
> I've included the files and the output below my sig. If someone could
> cast an expert eye over them....
> # ---- baz.xsl -------------------
[...]
> <xsl:template match="/">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
Please note ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> <head>
> <title>
> <xsl:text>RED :: </xsl:text>
> <xsl:value-of select="/document/@title"/>
> </title>
> </head>
> <body>
> <h1>
> <xsl:value-of select="/document/@title"/>
> </h1>
> <xsl:apply-templates/>
> </body>
> </html>
> </xsl:template>
>
> <xsl:template match="/document">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="a">
> <a href="{ href}">
well, after Daniel throwed an hint, I realized you just have to declare
xmlns="http://www.w3.org/1999/xhtml" in the 1st non-xsl tag for each
xsl:template block. E.g. the line above should have been:
<a href="{ href}" xmlns="http://www.w3.org/1999/xhtml">
> <img src="img/item.gif" alt="[click]"/>
> <xsl:value-of select="."/>
> </a>
> </xsl:template>
>
> <xsl:template match="*">
> <xsl:copy>
>
> <!-- xsl:copy-of select="@*" -->
>
> <xsl:for-each select="@*">
> <xsl:copy/>
> </xsl:for-each>
>
> <xsl:apply-templates/>
> </xsl:copy>
> </xsl:template>
here I suppose you should add an <xsl:attribute> forcing again
xmlns (but I'm guessing, maybe it's a shot in the dark)
The weirdest thing is that my theory works for me, but doesn't apply
to your example, because you get correct xmlns in your <a> tags:
> # ---- OUTPUT ---------------------------
[...]
> <i>Generated by <a xmlns="http://www.w3.org/1999/xhtml" href="http://www.lipsum.com/">
This lets me believe I've not understood where the real problem is :)
--
Simone Piunno -- http://members.ferrara.linux.it/pioppo
.------- Adde parvum parvo magnus acervus erit -------.
Ferrara Linux Users Group - http://www.ferrara.linux.it
Deep Space 6, IPv6 on Linux - http://www.deepspace6.net
GNU Mailman, Mailing List Manager - http://www.list.org
`-------------------------------------------------------'
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]