DISQUS

bearlog: XMPP PubSub + XSLT

  • bmalkow · 11 months ago
    It works for me (see below). But (maybe it is wrong) in Your xslt You should generate "<body/>" because Tigase put transformation result as child of <message/>, not <message><body/> . In this solution You can also generate <subject/> or xml:lang in <body/>.


    <iq type='set'
    to='pubsub.sphere'
    id='pub1'>
    <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='princely_musings'>
    <item id='1232'>
    <entry xmlns='http://www.w3.org/2005/Atom'>
    <title>Soliloquy</title>
    <summary>
    To be, or not to be: that is the question:
    Whether 'tis nobler in the mind to suffer
    The slings and arrows of outrageous fortune,
    Or to take arms against a sea of troubles,
    And by opposing end them?
    </summary>
    <link rel='alternate' type='text/html'
    href='http://denmark.lit/2003/12/13/atom03'/>
    <id>tag:denmark.lit,2003:entry-32397</id>
    <published>2003-12-13T18:30:02Z</published>
    <updated>2003-12-13T18:30:02Z</updated>
    </entry>
    </item>
    </publish>
    </pubsub>
    </iq>


    <iq from="pubsub.sphere" type="result" id="pub1" to="alice@sphere/sphere" />


    <message from="pubsub.sphere" id="2" to="alice@sphere" >
    <html xmlns="http://www.w3.org/1999/xhtml">
    <body>
    <div>
    Soliloquy


    To be, or not to be: that is the question:
    Whether 'tis nobler in the mind to suffer
    The slings and arrows of outrageous fortune,
    Or to take arms against a sea of troubles,
    And by opposing end them?


    </div>
    </body>
    </html>
    <event xmlns="http://jabber.org/protocol/pubsub#event">
    <items node="princely_musings" >
    <item id="1232" >
    <entry xmlns="http://www.w3.org/2005/Atom">
    <title>Soliloquy</title>
    <summary>
    To be, or not to be: that is the question:
    Whether 'tis nobler in the mind to suffer
    The slings and arrows of outrageous fortune,
    Or to take arms against a sea of troubles,
    And by opposing end them?
    </summary>
    <link rel="alternate" href="http://denmark.lit/2003/12/13/atom03" type="text/html" />
    <id>tag:denmark.lit,2003:entry-32397</id>
    <published>2003-12-13T18:30:02Z</published>
    <updated>2003-12-13T18:30:02Z</updated>
    </entry>
    </item>
    </items>
    </event>
    </message>
  • Tom Carden · 11 months ago
    Just a heads up in case you're testing with a client that throws away pubsub messages...

    I've had trouble with pubsub messages in Adium where even though the XML console shows that the message was received, the body doesn't get displayed as a regular chat message. I'm pretty sure it's the same as this issue http://trac.adiumx.com/ticket/9146 and it's worth noting I have no such problems when testing with Psi or Spark, which both show the message body as expected.
  • bear · 11 months ago
    That is the exact type of problem we are trying to avoid by offering a "true" body option with our PubSub events - to allow people who are consuming them who are using clients which ignore non-chat messages to having something to view.

    Like all things feature-rich, just have to get all our pieces in place and pointing at the same place :)

    thanks!
  • kael · 11 months ago
    The implementation of pubsub#dataform_xslt is awesome ! :)
    Gotta have look at Tigase.
  • ywam · 8 months ago
    Hi,
    Thanks for sharing the code................ : )
  • crisfrankel · 4 months ago
    Great post. What's the difference btwen ATOM and RSS 2.0?
    http://www.frankelcoachinggroup.com
  • bear · 4 months ago
    Both Atom and RSS 2.0 are xml, so you can use this script as a start for RSS 2.0 - but the structure and content would be different. See http://www.rssboard.org/rss-specification for what goes into RSS 2.0 content.