abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Re: XML stylesheet and W3C standard implementation
Date Tue, 22 Jan 2008 23:22:35 GMT
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.

- James

Vincent Hiribarren wrote:
> Hello all,
> 
> I am trying Abdera to generate Atom documents through servlets.
> 
> So far, I am quite happy with this API.
> 
> Then, I wanted to associate an Atom XML document with a stylesheet
> through an XML preprocessing instruction.
> 
> I found  the Document.addStylesheet() method. However, I am not sure
> its comportment is standard.
> 
> Its interface is:
> void addStylesheet(java.lang.String href, java.lang.String media);
> 
> But according to http://www.w3.org/TR/xml-stylesheet/ the "media"
> attribute seems to be optional on one hand; on another hand, the
> "type" attribute seems to be required. I have done some tests with
> Safari and Firefox: they cannot process an XML document with its
> associated XSL stylesheet if the "type" attribute is not here.
> 
> So instead of using addStylesheet, I am using
> Document.addProcessingInstruction() to forge a correct XSL
> preprocessing instruction.
> 
> A patch is quite easy to do, but it would break the compatibility with
> the current interface: personnaly, I would change
> void addStylesheet(String href, String media)
> to
> void addStylesheet(String href, String type)
> and possibly add a
> void addStylesheet(String href, String type, String media)
> method.
> 
> But mayhaps I missed a point, so I just wanted to talk about that here
> in order to know if there is a problem with the W3C standard or not.
> If you think there really is a problem, I will submit a patch or open
> a bug report.
> 
> Regards,
> 
> V. Hiribarren
> 

Mime
View raw message