Created
January 20, 2011 22:25
-
-
Save ngs/788813 to your computer and use it in GitHub Desktop.
List Flickr photo using Apache cocoon
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="http://www.w3.org/1999/xhtml" | |
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
| xmlns:s="http://www.w3.org/2003/05/soap-envelope" | |
| xmlns:x="urn:flickr" | |
| exclude-result-prefixes="s x"> | |
| <xsl:template match="/"> | |
| <html> | |
| <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> | |
| <meta content="text/javascript" http-equiv="Content-Script-Type" /> | |
| <meta content="text/css" http-equiv="Content-Style-Type" /> | |
| <head> | |
| <title>flickr.photos.getRecent</title> | |
| </head> | |
| <body> | |
| <ul> | |
| <xsl:apply-templates select="//photos/photo" /> | |
| </ul> | |
| </body> | |
| </html> | |
| </xsl:template> | |
| <xsl:template match="//photos/photo"> | |
| <xsl:variable name="img" select="concat('http://farm',@farm,'.static.flickr.com/',@server,'/',@id,'_',@secret,'_t.jpg')" /> | |
| <li id="img-{@id}"> | |
| <img src="{$img}" title="{@title}" /> | |
| <xsl:value-of select="@title" /> | |
| </li> | |
| </xsl:template> | |
| </xsl:stylesheet> |
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"?> | |
| <xsp:page | |
| language="java" | |
| xmlns:s="http://www.w3.org/2003/05/soap-envelope" | |
| xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" | |
| xmlns:xsd="http://www.w3.org/1999/XMLSchema" | |
| xmlns:xsp="http://apache.org/xsp" | |
| xmlns:xsp-request="http://apache.org/xsp/request/2.0" | |
| xmlns:xscript="http://apache.org/xsp/xscript/1.0" | |
| xmlns:soap="http://apache.org/xsp/soap/3.0" | |
| > | |
| <page> | |
| <xscript:variable name="soapresult"> | |
| <soap:call url="http://api.flickr.com/services/soap/"> | |
| <x:FlickrRequest xmlns:x="urn:flickr"> | |
| <api_key>[YOUR FLICKR API KEY]</api_key> | |
| <method>flickr.photos.getRecent</method> | |
| </x:FlickrRequest> | |
| </soap:call> | |
| </xscript:variable> | |
| <xscript:variable name="stylesheet"> | |
| <xsl:stylesheet | |
| version="1.0" | |
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
| xmlns:s="http://www.w3.org/2003/05/soap-envelope" | |
| xmlns:x="urn:flickr" | |
| exclude-result-prefixes="x"> | |
| <xsl:template match="/"> | |
| <xsl:value-of select="//x:FlickrResponse" disable-output-escaping="yes" /> | |
| </xsl:template> | |
| </xsl:stylesheet> | |
| </xscript:variable> | |
| <xscript:transform name="soapresult" stylesheet="stylesheet"/> | |
| </page> | |
| </xsp:page> |
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"?> | |
| <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> | |
| <map:pipelines> | |
| <map:pipeline> | |
| <map:match pattern="*"> | |
| <map:generate src="xscript/{1}.xsp" type="serverpages"/> | |
| <map:transform src="stylesheets/{1}.xsl" /> | |
| <map:serialize/> | |
| </map:match> | |
| </map:pipeline> | |
| </map:pipelines> | |
| </map:sitemap> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment