Skip to content

Instantly share code, notes, and snippets.

@zeen
Created April 12, 2011 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeen/916477 to your computer and use it in GitHub Desktop.
Save zeen/916477 to your computer and use it in GitHub Desktop.
Scripts to convert the XMPP.org services table to XML.
XSL files to convert Wordpress XMPP services table into XML.
curl http://xmpp.org/resources/public-services/ > services.html
xsltproc --html services-full.xsl services.html > services-full.xml
xsltproc --html services.xsl services.html > services.xml
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<query>
<xsl:apply-templates select="//table/tbody/tr[@class!='row-1']"/>
</query>
</xsl:template>
<xsl:template match="tr">
<item><xsl:attribute name="jid"><xsl:value-of select="td[@class='column-1']"/></xsl:attribute>
<server-software><xsl:value-of select="td[@class='column-7']"/></server-software>
<domain><xsl:value-of select="td[@class='column-1']"/></domain>
<homepage><xsl:value-of select="td[@class='column-1']/a/@href"/></homepage>
<primary-admin><xsl:value-of select="td[@class='column-8']/a/@href"/></primary-admin>
<longitude>
<xsl:if test="string(td[@class='column-5']) != '-'">
<xsl:value-of select="td[@class='column-5']"/>
</xsl:if>
</longitude>
<latitude>
<xsl:if test="string(td[@class='column-4']) != '-'">
<xsl:value-of select="td[@class='column-4']"/>
</xsl:if>
</latitude>
<description><xsl:value-of select="td[@class='column-1']/a/@title"/></description>
</item>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:comment>
This file lists the open XMPP servers registered with the XSF.
The format of this file is defined by the Service Discovery
protocol: http://xmpp.org/extensions/xep-0030.html
To add your server to the list, follow the instructions at
http://xmpp.org/services/register.shtml
</xsl:comment>
<query>
<xsl:apply-templates select="//table/tbody/tr[@class!='row-1']"/>
</query>
</xsl:template>
<xsl:template match="tr">
<item><xsl:attribute name="jid"><xsl:value-of select="td[@class='column-1']"/></xsl:attribute>
</item>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment