xsl-list
[Top] [All Lists]

RE: Why doesn't exclude-result-prefixes rid me of xmlns=""?

2004-04-13 01:41:28
You have created an <html> element in the "http://www.w3.org/1999/xhtml";
namespace, and within it you have created a <div> element that is in no
namespace. The xmlns="" is generated in order to ensure that the <div>
element is in no namespace, which is what you requested. If you want the
<div> element to be in the XHTML namespace, you need to ensure that the
<div> element in the stylesheet has an xmlns="http://www.w3.org/1999/xhtml";
declaration in scope.

Responding to the question in your subject line, exclude-result-prefixes is
provided to help you get rid of namespaces declarations that are not used in
the result document. It will never get rid of namespace declarations that
are generated to put elements in the right namespace.

Michael Kay

-----Original Message-----
From: Michael Terry [mailto:formido(_at_)mac(_dot_)com] 
Sent: 13 April 2004 08:05
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Why doesn't exclude-result-prefixes rid me of xmlns=""?

Hi,

After searching Google, I figured out how to 
exclude-result-prefixes,  
but I'm still getting an unwanted 'xmlns=""' in one of my outputted  
divs. Can someone tell me why?

Following on, I've included excerpts from the source, the 
script, and  
the result. At the bottom, I pasted in the browser display from the  
result of running the processor-version.xsl on itself, plus links to  
the relevant full texts, should they be necessary.

--------------------------------------
dictionary.xmloutline (source excerpt)
--------------------------------------
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE oo:outline PUBLIC "-//omnigroup.com//DTD OUTLINE 2.0//EN"  
"xmloutline-v2.dtd">
<outline 
xmlns:oo="http://www.omnigroup.com/namespace/OmniOutliner/v2";  
version="1.0">
   <oo:columns>

... snip ...

  <oo:root background-color='#ffffff' alternate-color='#d6ffed'>
     <oo:item expanded="yes">
       <oo:values>
         <oo:rich-text><oo:p alignment="left"><oo:font face="Monaco"  
size="10">OmniWeb:</oo:font></oo:p></oo:rich-text>
       </oo:values>
       <oo:children>
         <oo:item expanded="yes">
           <oo:values>
             <oo:rich-text><oo:p alignment="left"><oo:font 
face="Monaco"  
size="10">classes:</oo:font></oo:p></oo:rich-text>
           </oo:values>
           <oo:children>
             <oo:item expanded="yes">
               <oo:values>
                 <oo:rich-text><oo:p alignment="left"><oo:font  
face="Monaco" size="10">application:</oo:font></oo:p></oo:rich-text>
               </oo:values>
               <oo:children>
                 <oo:item expanded="yes">
                   <oo:values>
                     <oo:rich-text><oo:p alignment="left"><oo:font  
face="Monaco" size="10">commands:</oo:font></oo:p></oo:rich-text>
                   </oo:values>
                   <oo:children>
                     <oo:item expanded="yes">
                       <oo:values>
                         <oo:rich-text><oo:p><oo:font face="Monaco"  
size="10">activate:</oo:font></oo:p></oo:rich-text>
                       </oo:values>
                       <oo:children>

--------------------------------------
format_dictionary.xsl (full text)
--------------------------------------
<?xml version="1.0"?>

<xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
      xmlns:oo="http://www.omnigroup.com/namespace/OmniOutliner/v2";
      exclude-result-prefixes="oo">

      <xsl:output
              method="xml"
              indent="yes"
              
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
              doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
              
<xsl:template match="/">
      <html xmlns="http://www.w3.org/1999/xhtml"; 
xml:lang="en" lang="en">
              <head>
                      <title>OmniWeb AppleScript Documentation</title>
                      <meta http-equiv="Content-Type" 
content="text/html;  
charset=us-ascii"/>
              </head>
              <body>
              <xsl:apply-templates select="outline/oo:root"/>
              </body>
      </html>
</xsl:template>

<xsl:template match="oo:root">
      <xsl:apply-templates select="oo:item"/>
</xsl:template>

<xsl:template match="oo:item">
      <div>
      <xsl:value-of select="./oo:values/oo:rich-text/oo:p"/>
      <xsl:apply-templates select="oo:children/oo:item"/>
      </div>  
</xsl:template>

</xsl:stylesheet>

--------------------------------------
dictionary.html (result excerpt)
--------------------------------------
<?xml versioasdfsan="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
<head>
<title>OmniWeb AppleScript Documentation</title>
<meta http-equiv="Content-Type" content="text/html; 
charset=us-ascii" />
</head>
<body>
<div  
xmlns="">OmniWeb:<div>classes:<div>application:<div>commands: 
<div>activate:<div>activate</div>
</div>
<div>count:<div>count</div>
<div>count it each browser</div>
<div>count each browser</div>
</div>

--------------------------------------
processor version info
--------------------------------------
Vendor: Apache Software Foundation
Vendor URL: http://xml.apache.org/xalan-c

--------------------------------------
links to full texts
--------------------------------------
<http://homepage.mac.com/formido/dictionary.xmloutline>
<http://homepage.mac.com/formido/format_dictionary.xsl>
<http://homepage.mac.com/formido/dictionary.html>
<http://homepage.mac.com/formido/processor_version_info.html>

Mike


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--