Namespace mixup (WAS: Re: This file is not well formed....)

Subject: Namespace mixup (WAS: Re: This file is not well formed....)
From: "John E. Simpson" <simpson@xxxxxxxxxxx>
Date: Thu, 12 Oct 2000 09:36:37 -0400
Marcos --

Once you include the XML declaration in your XML file, as I just mentioned in my previous reply, you'll probably find the stylesheet doesn't do what you want. The problem is that you've got your namespaces mixed up.

To recap, here's your stylesheet:

At 04:17 AM 10/12/2000 -0700, Marcos Coelho wrote:
----------------------- XSL files -------------------------

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="";>
<xsl:template match="COSMO">
       <title>XML --> XSL ---> HTML </title>
       <xsl:for-each select="NOTICIAS">
<xsl:value-of select="TITULO"/><br/>
<xsl:value-of select="DATA"/><br/>
<xsl:value-of select="CONTEUDO"/><br/>
<xsl:value-of select="TITULO"/><br/>
<xsl:value-of select="TITULO"/><br/>
<xsl:value-of select="TITULO"/><p/>

There's one namespace declaration in it, the xmlns:xsl="..." attribute of the xsl:stylesheet element. What yours is saying is that any element names prefixed with "xsl:" are from the HTML 4.0 namespace. That's not really the case, though; those element names are from the *XSLT* namespace. In your stylesheet, the element names with *no* prefix (like p and br) are from the HTML 4.0 namespace.

So you need an xsl:stylesheet element that looks like this instead:


(Note that if your XSLT processor complies with the XSLT spec, you also need the version="1.0" attribute.)

I think the results will then be much closer to what you were hoping to see.

John E. Simpson | "He asked me if I knew what | time it was. I said, 'Yes, but
XML Q&A: | not right now.'" (Steven Wright)

XSL-List info and archive:

Current Thread