This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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="http://www.w3.org/TR/REC-html40">
><xsl:template match="COSMO">
>    <html>
>      <head>
>        <title>XML --> XSL ---> HTML </title>
>      </head>
>    <body>
>        <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/>
></xsl:for-each>
>    </body>
>    </html>
></xsl:template>
></xsl:stylesheet>

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:

    <xsl:stylesheet
         version="1.0"
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
         xmlns="http://www.w3.org/TR/REC-html40">

(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
http://www.flixml.org         | time it was. I said, 'Yes, but
XML Q&A: http://www.xml.com   | not right now.'" (Steven Wright) 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]