Created
December 23, 2014 20:19
-
-
Save JamiesonRoberts/6f686aa4eb95cf453f88 to your computer and use it in GitHub Desktop.
XML export file for migrating content between Cascade and Wordpress
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" encoding="UTF-8"?> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:output method="xml" omit-xml-declaration="yes"/> | |
<!-- URL prefix for news item links --> | |
<xsl:variable name="website_prefix">http://communications.uwo.ca</xsl:variable> | |
<xsl:variable name="currentDateTime" select="//system-index-block/@current-time"/> | |
<!-- File extension used --> | |
<xsl:variable name="file_extension">.html</xsl:variable> | |
<!-- RSS extension to use --> | |
<xsl:variable name="rss_extension">.xml</xsl:variable> | |
<!-- Name of RSS generator --> | |
<xsl:variable name="rss_generator">Cascade Server</xsl:variable> | |
<xsl:include href="/_cms/formats/format-date"/> | |
<!-- whole page/root stuff --> | |
<xsl:template match="/system-index-block"> | |
<rss version="2.0"> | |
<channel> | |
<title>Western News</title> | |
<description/> | |
<link>http://communications.uwo.ca</link> | |
<lastBuildDate><xsl:call-template name="format-date"> | |
<xsl:with-param name="date" select="currentDateTime"/> | |
<xsl:with-param name="mask">UTC:yyyy-mm-dd'T'HH:MM:ss'Z'</xsl:with-param> | |
</xsl:call-template></lastBuildDate> | |
<generator>Cascade Server</generator> | |
<xsl:apply-templates mode="news" select="//system-page[name!='index']"><xsl:sort order="descending" select="start-date"/></xsl:apply-templates> | |
</channel> | |
</rss> | |
</xsl:template> | |
<xsl:template match="system-page" mode="news"> | |
<item> | |
<title><xsl:value-of select="title"/></title> | |
<link><xsl:value-of select="$website_prefix"/><xsl:value-of select="path"/>.html</link> | |
<description>[cascade:cdata]<xsl:value-of select="summary"/>[/cascade:cdata]</description> | |
<content>[cascade:cdata]<xsl:copy-of select="system-data-structure/content/node()"/>[/cascade:cdata]</content> | |
<contentForImg> | |
<xsl:for-each select="system-data-structure/content//img"> | |
<images> | |
<xsl:value-of select="@src"/> | |
</images> | |
</xsl:for-each> | |
</contentForImg> | |
<xsl:choose> | |
<xsl:when test="dynamic-metadata[name='writers']/value = ' '"> | |
<author>jason.winders@uwo.ca</author> | |
</xsl:when> | |
<xsl:when test="dynamic-metadata[name='writers']/value = 'Communications Staff'"> | |
<author>jason.winders@uwo.ca</author> | |
</xsl:when> | |
<xsl:when test="dynamic-metadata[name='writers']/value = 'Jason Winders'"> | |
<author>jason.winders@uwo.ca</author> | |
</xsl:when> | |
<xsl:when test="dynamic-metadata[name='writers']/value = 'Terry Rice'"> | |
<author>tjrice@uwo.ca</author> | |
</xsl:when> | |
<xsl:when test="dynamic-metadata[name='writers']/value = 'Adela Talbot'"> | |
<author>adela.talbot@uwo.ca</author> | |
</xsl:when> | |
<xsl:when test="dynamic-metadata[name='writers']/value = 'Paul Mayne'"> | |
<author>pmayne@uwo.ca</author> | |
</xsl:when> | |
</xsl:choose> | |
<guestAuthor><xsl:value-of select="author"/></guestAuthor> | |
<xsl:choose> | |
<xsl:when test="system-data-structure/photo/path/node() = '/'"> | |
<thumbnailimg/> | |
</xsl:when> | |
<xsl:otherwise> | |
<thumbnailimg><xsl:copy-of select="concat($website_prefix,system-data-structure/photo/path/node())"/></thumbnailimg> | |
</xsl:otherwise> | |
</xsl:choose> | |
<pubDate><xsl:call-template name="format-date"> | |
<xsl:with-param name="date" select="start-date"/> | |
<xsl:with-param name="mask">UTC:yyyy-mm-dd'T'HH:MM:ss'Z'</xsl:with-param> | |
</xsl:call-template> | |
</pubDate> | |
</item> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment