Created
December 30, 2019 20:47
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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