Created
March 28, 2017 21:07
-
-
Save vicziani/e4779408189fcd1d8165a1f0f5f7f966 to your computer and use it in GitHub Desktop.
Tumlr Blogger xml formátum transzformáció
This file contains hidden or 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 version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:fn="http://www.w3.org/2005/xpath-functions" | |
> | |
<xsl:template match="/"> | |
<feed xmlns='http://www.w3.org/2005/Atom' | |
xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' | |
xmlns:gd='http://schemas.google.com/g/2005' | |
xmlns:thr='http://purl.org/syndication/thread/1.0'> | |
<id>tag:blogger.com,1999:blog-123456789.archive</id> | |
<updated>2011-01-14T00:00:00.000+02:00</updated> | |
<title type='text'>Sample import file</title> | |
<author> | |
<name>Foo Bar</name> | |
<uri>http://www.blogger.com/profile/123456789</uri> | |
<email>[email protected]</email> | |
</author> | |
<generator version='7.00' uri='http://www.blogger.com'>Blogger</generator> | |
<xsl:for-each select="tumblr/posts/post"> | |
<entry> | |
<id>tag:blogger.com,1999:blog-123456789.post-123456789</id> | |
<!-- | |
A két XML-ben eltér a dátum formátum, így konvertálás szükséges. | |
A Tumblr formátuma: 2010-11-15 13:44:00 GMT | |
A Blogger formátuma: 2006-11-24T18:33:16.0000000-08:00 | |
--> | |
<published> | |
<xsl:value-of select="concat(substring(@date-gmt, 1, 10), 'T', substring(@date-gmt, 12, 8))"/> | |
</published> | |
<updated> | |
<xsl:value-of select="concat(substring(@date-gmt, 1, 10), 'T', substring(@date-gmt, 12, 8))"/> | |
</updated> | |
<category scheme='http://schemas.google.com/g/2005#kind' | |
term='http://schemas.google.com/blogger/2008/kind#post'/> | |
<xsl:for-each select="tag"> | |
<category scheme='http://www.blogger.com/atom/ns#'> | |
<xsl:attribute name="term"> | |
<xsl:value-of select="text()"/> | |
</xsl:attribute> | |
</category> | |
</xsl:for-each> | |
<title type='text'> | |
<xsl:value-of select="regular-title"/> | |
</title> | |
<content type='html'> | |
<xsl:value-of select="regular-body"/> | |
</content> | |
<author> | |
<name>Foo Bar</name> | |
<uri>http://www.blogger.com/profile/123456789</uri> | |
<email>[email protected]</email> | |
</author> | |
<thr:total>0</thr:total> | |
</entry> | |
</xsl:for-each> | |
</feed> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment