abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arun Kumar S03 <ArunKumar_...@infosys.com>
Subject RE: XML stylesheet and W3C standard implementation
Date Wed, 23 Jan 2008 09:38:34 GMT

Can you please remove me from this group?

Thanks,
Arun

-----Original Message-----
From: David Calavera [mailto:david.calavera@gmail.com]
Sent: Wednesday, January 23, 2008 2:22 PM
To: abdera-user@incubator.apache.org
Subject: Re: XML stylesheet and W3C standard implementation

On Jan 23, 2008 12:22 AM, James M Snell <jasnell@gmail.com> wrote:

> The challenge with PI's is that there actually is no single correct
> syntax for them.  There's just the target and the value.  Whether or not
> the value is structured depends entirely on the target.
>
> To associate an xml-stylesheet PI with a feed, you need to do it like
> this:
>
>   Abdera abdera = Abdera.getInstance();
>   Feed feed = abdera.newFeed();
>   Document doc = feed.getDocument();
>   doc.addProcessingInstruction(
>     "xml-stylesheet",
>     "href=\"foo.css\" type=\"text/css\"");
>   doc.writeTo(System.out);
>
> Keep in mind also that IE7 and FF 2.x will likely ignore the stylesheet.


There are a little trick in order to force IE7 and FF2.x to use your
stylesheet. Look at this article:

http://www.ibm.com/developerworks/xml/library/x-think40/

A little excerpt:

The only way to work around this and force the use of your chosen stylesheet
> is to fool the simple heuristic Firefox uses to check for Web feeds, which
> involves sniffing the first 512 bytes of the file for the words "rss" or
> "feed". Listing 2 uses the well-known workaround inserting a comment
> designed to pad out this 512 bytes.
>
> *Listing 2. Atom feed with workaround for Firefox 2.0 and Internet
> Explorer 7 stylesheet default handling*
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <!-- Firefox 2.0 and Internet Explorer 7 use simplistic feed sniffing to override
desired
> presentation behavior for this feed, and thus we are obliged to insert this comment,
a
> bit of a waste of bandwidth, unfortunately. This should ensure that the following
> stylesheet processing instruction is honored by these new browser versions. For some
more
> background you might want to visit the following bug report:
> https://bugzilla.mozilla.org/show_bug.cgi?id=338621
> -->
> <?xml-stylesheet type="text/xml" href="atom2html.xslt"?>
> <feed xmlns="http://www.w3.org/2005/Atom"
>       xml:lang="en"
>       xml:base="http://www.example.org">
> <!-- content of the feed identical to listing 1, so trimmed -->
> </feed>
>
>



--
David Calavera
http://www.thinkincode.net

**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of
the addressee(s). If you are not the intended recipient, please notify the sender by e-mail
and delete the original message. Further, you are not to copy, disclose, or distribute this
e-mail or its contents to any other person and any such actions are unlawful. This e-mail
may contain viruses. Infosys has taken every reasonable precaution to minimize this risk,
but is not liable for any damage you may sustain as a result of any virus in this e-mail.
You should carry out your own virus checks before opening the e-mail or attachment. Infosys
reserves the right to monitor and review the content of all messages sent to or from this
e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys
e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Mime
View raw message