Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

[Rant] [Rival] Firefox versus IE: XSL namepsace stupidity

  • Subject: [Rant] [Rival] Firefox versus IE: XSL namepsace stupidity
  • From: The Ghost In The Machine <ewill@xxxxxxxxxxxxxxxxxxxxxxx>
  • Date: Thu, 8 Nov 2007 17:36:19 -0800
  • Newsgroups: comp.os.linux.advocacy
  • User-agent: slrn/0.9.8.1 (Linux)
  • Xref: ellandroad.demon.co.uk comp.os.linux.advocacy:574516
Time for yet another of my Specialized Rants(tm) on the
stupidity of IE when it comes to namespaces.  It's
bitten me yet again.

On Firefox, namespaces are pretty trivial (though it
might look like GlobbyGlop(tm) for those not that
familiar with all this).  Set up the XML (for
this rant call it example.xml):

   <?xml version="1.0" encoding="UTF-8"?>
   <?xml-stylesheet href="something.xsl" type="text/xsl"?>
   <ad-hoc-stuff
      xmlns="http://www.adhocjunk.com/2007/stuff";
      xmlns:h="http://www.w3.org/1999/xhtml";
   >
      <blah>
         <blahdoc>
	   <h:h2>Advantages of <h:a href="...">Firefox</h:a></h:h2>
	   <h:ul>
	     <h:li>It's free</h:li>
	     <h:li>It's open</h:li>
	     <h:li>It's wonderful</h:li>
	   </h:ul>
	   <h:h2>Disadvantages of Firefox</h:h2>
	   None!
	 </blahdoc>
	 ...
      </blah>

The h: is a namespace prefix, basically a qualifier
(one can use html:, fred:, or xoaglailwieuriluhbwhoih:
as one wishes; it's a QName). In this case, h: refers to a
known prefix documented by the World Wide Web consortium
for XHTML; if a browser sees this, it should render the
text nicely.  <h:h2> is a header, <h:li> is a list element,
all documented in HTML 4.01 or XHTML (there's not that much
difference); <h:ul> is an unnumbered list.  The rest is
ad hoc or should be fairly obvious.

Beyond pointing out the header in something.xsl:

   <?xml version="1.0" encoding="UTF-8"?>
   <xsl:stylesheet
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
       xmlns:a="http://www.adhocjunk.com/2007/stuff";
       xmlns:h="http://www.w3.org/1999/xhtml";
    >
   <xsl:output method="html" />

   <xsl:template match="a:blahdoc">
      <h:head>
         <h:title>Ad hoc fun stuff</h:title>
   ...
   </xsl:template>
   <xsl:template match="a:somethingelse>
   ...
   </xsl:template>
   ...
   </xsl:stylesheet>

I won't go into much more detail; those that are
interested can look at http://www.w3.org/TR/xslt and
http://www.w3.org/TR/xpath, http://www.w3.org/TR/html401,
http://www.w3.org/TR/xhtml1, and various tutorials.
Works fine in Firefox.  (Be careful to use xsl:copy-of
instead of xsl:value-of; you'll lose the subtags otherwise.)

But that ... um ... other browser?  Gets very confused!
Yeppers, brilliance in action on IE's part forces each and
every web developer that wants to support IE to rewrite
the namespaces in XML so that HTML is the
unnamed space everywhere:

   <?xml version="1.0" encoding="UTF-8"?>
   <?xml-stylesheet href="something.xsl" type="text/xsl"?>
   <a:ad-hoc-stuff
      xmlns:a="http://www.adhocjunk.com/2007/stuff";
      xmlns="http://www.w3.org/1999/xhtml";
   >
   <a:blah>
      <a:blahdoc>
         <h2>Advantages of <a href="...">Firefox</a></h2>
   ...

and of course XSL has to be changed as well:

   <?xml version="1.0" encoding="UTF-8"?>
   <xsl:stylesheet
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
       xmlns:a="http://www.adhocjunk.com/2007/stuff";
       xmlns="http://www.w3.org/1999/xhtml";
    >
   <xsl:output method="html" />
   <xsl:template match="a:blahdoc">
      <head>
         <title>Ad hoc fun stuff</title>
   ...

Once again Microsoft is dictating where we all want to
go today.  Thank you Microsoft for mucking up what should
have been a very straightforward problem.  (And this is
*after* deprecating the <APPLET> tag, but that's another
rant for another day.)

I sure hope IE7 fixes this but have my doubts.  (To be
fair, Java's JEditorPane isn't any better, really.
Of course no one uses it anyway; Swing's Browser class is
much more capable as it leverages Mozilla, or one can just
subinvoke the browser directly.)

Feh.

We now return you to your regularly scheduled argument,
already in progress.

    Man:
    ... told outside that...

    Angry man:
    DON'T GIVE ME THAT, YOU SNOTTY-FACED HEAP OF PARROT DROPPINGS!

    Man:
    What?

    Angry man:
    SHUT YOUR FESTERING GOB, YOU TIT! YOUR TYPE MAKES ME PUKE! YOU
    VACUOUS TOFFEE-NOSED MALODOROUS PERVERT!

    Man:
    Yes, but I came here for an argument!!

    Angry man:
    OH! Oh! I'm sorry! This is abuse!

    Man:
    Oh! Oh I see!

    Angry man:
    Aha! No, you want room 12A, next door.

    M:
    Oh...Sorry...

    Angry man:
    Not at all!
    (under his breath) stupid git.

    (The man goes into room 12A. Another man is sitting behind a desk.)

    Man:
    Is this the right room for an argument?

    Other Man:(John Cleese)
    I've told you once....

(courtesy of
http://www.jumpstation.ca/recroom/comedy/python/argument.html)

-- 
#191, ewill3@xxxxxxxxxxxxx
Useless C/C++ Programming Idea #2239120:
void f(char *p) {char *q = p; strcpy(p,q); }

-- 
Posted via a free Usenet account from http://www.teranews.com


[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index