Skip to content

Instantly share code, notes, and snippets.

@gwollman
Created December 30, 2019 20:47
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save gwollman/33541130209f12939dace60a69dd1b38 to your computer and use it in GitHub Desktop.
A simple XSLT transform to extract post dates and titles from a WordPress export file
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wp="http://wordpress.org/export/1.2/"
version='1.0'>
<xsl:output method='text' encoding='utf-8'/>
<xsl:template match="/">
<xsl:apply-templates select="/rss/channel/item[wp:post_type = 'post']"/>
</xsl:template>
<xsl:template match="/rss/channel/item">
<xsl:value-of select="wp:post_date/text()"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="title/text()"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment