[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
chris mcgrath namespace
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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.