XSL null output, basic RSS feed
git-svn-id: http://yolanda.mister-muffin.de/svn@211 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
3b99d00bcc
commit
2c3acd9344
7 changed files with 173 additions and 48 deletions
|
@ -185,6 +185,11 @@
|
|||
<string id="account_pagesize">pagesize</string>
|
||||
<string id="account_cortado">cortado</string>
|
||||
|
||||
<!-- rss feed -->
|
||||
<string id="rss_separator"> - </string>
|
||||
<string id="rss_description_1">This is an Yolanda RSS Feed for query "</string>
|
||||
<string id="rss_description_2">".</string>
|
||||
|
||||
</strings>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
|
@ -4,28 +4,29 @@
|
|||
<strings>
|
||||
|
||||
<!-- visible -->
|
||||
<str id="site_name">Yolanda</str>
|
||||
<str id="site_motto">WebTV free as in Speech</str>
|
||||
<string id="site_name">Yolanda</string>
|
||||
<string id="site_motto">WebTV free as in Speech</string>
|
||||
|
||||
<!-- invisible -->
|
||||
<str id="page_account">/account.pl</str>
|
||||
<str id="page_account_settings">/account.pl?show=settings</str>
|
||||
<str id="page_account_uploads">/account.pl?show=uploads</str>
|
||||
<str id="page_account_bookmarks">/account.pl?show=bookmarks</str>
|
||||
<str id="page_login">/login.pl</str>
|
||||
<str id="page_login-openid">/login.pl?action=openid</str>
|
||||
<str id="page_logout">/login.pl?action=logout</str>
|
||||
<str id="page_authors">http://yolanda.mister-muffin.de/trac</str>
|
||||
<str id="page_license">http://www.fsf.org/licensing/licenses/agpl-3.0.html</str>
|
||||
<str id="page_source-code">http://yolanda.mister-muffin.de/trac/browser/trunk</str>
|
||||
<str id="page_register">/register.pl</str>
|
||||
<str id="page_report_bug">http://yolanda.mister-muffin.de/trac/newticket</str>
|
||||
<str id="page_results">search.pl?query=</str>
|
||||
<str id="page_upload">/upload.pl</str>
|
||||
<str id="page_uploader">uploader.pl</str>
|
||||
<str id="page_query_latestadditions">search.pl?query=&orderby=timestamp&sort=desc</str>
|
||||
<str id="page_query_mostdownloads">search.pl?query=&orderby=downloadcount&sort=desc</str>
|
||||
<str id="page_query_mostviews">search.pl?query=&orderby=viewcount&sort=desc</str>
|
||||
<string id="page_account">/account.pl</string>
|
||||
<string id="page_account_settings">/account.pl?show=settings</string>
|
||||
<string id="page_account_uploads">/account.pl?show=uploads</string>
|
||||
<string id="page_account_bookmarks">/account.pl?show=bookmarks</string>
|
||||
<string id="page_login">/login.pl</string>
|
||||
<string id="page_login-openid">/login.pl?action=openid</string>
|
||||
<string id="page_logout">/login.pl?action=logout</string>
|
||||
<string id="page_authors">http://yolanda.mister-muffin.de/trac</string>
|
||||
<string id="page_license">http://www.fsf.org/licensing/licenses/agpl-3.0.html</string>
|
||||
<string id="page_source-code">http://yolanda.mister-muffin.de/trac/browser/trunk</string>
|
||||
<string id="page_register">/register.pl</string>
|
||||
<string id="page_report_bug">http://yolanda.mister-muffin.de/trac/newticket</string>
|
||||
<string id="page_results">search.pl?query=</string>
|
||||
<string id="page_root">http://localhost/</string>
|
||||
<string id="page_upload">/upload.pl</string>
|
||||
<string id="page_uploader">uploader.pl</string>
|
||||
<string id="page_query_latestadditions">search.pl?query=&orderby=timestamp&sort=desc</string>
|
||||
<string id="page_query_mostdownloads">search.pl?query=&orderby=downloadcount&sort=desc</string>
|
||||
<string id="page_query_mostviews">search.pl?query=&orderby=viewcount&sort=desc</string>
|
||||
|
||||
</strings>
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ a
|
|||
a.tag
|
||||
{
|
||||
display: inline-block;
|
||||
margin: 0.25em;
|
||||
padding: 0em;
|
||||
margin-left: 0.25em;
|
||||
margin-right: 0.25em;
|
||||
}
|
||||
|
||||
body
|
||||
|
|
24
trunk/xsl/null.xsl
Normal file
24
trunk/xsl/null.xsl
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns="http://xspf.org/ns/0/"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
>
|
||||
|
||||
<xsl:output
|
||||
encoding="utf8"
|
||||
indent="yes"
|
||||
method="xml"
|
||||
media-type="application/xml"
|
||||
omit-xml-declaration="no"
|
||||
/>
|
||||
|
||||
<xsl:template match="@*|node()">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
80
trunk/xsl/rss.xsl
Normal file
80
trunk/xsl/rss.xsl
Normal file
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns="http://purl.org/rss/1.0/"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
>
|
||||
|
||||
<xsl:output
|
||||
encoding="utf8"
|
||||
indent="yes"
|
||||
method="xml"
|
||||
media-type="application/xml"
|
||||
omit-xml-declaration="no"
|
||||
/>
|
||||
|
||||
<xsl:variable name="locale">
|
||||
<xsl:choose>
|
||||
<xsl:when test="document(concat('../locale/', //@locale, '.xml'))">
|
||||
<xsl:value-of select="//@locale" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>en-us</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="site_strings" select="document('../site/main.xml')//strings/string" />
|
||||
<xsl:variable name="locale_strings" select="document(concat('../locale/', $locale, '.xml'))//strings/string" />
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="results">
|
||||
|
||||
<rdf:RDF>
|
||||
|
||||
<channel>
|
||||
<xsl:attribute name="rdf:about">
|
||||
<xsl:value-of select="$site_strings[@id='page_root']" />
|
||||
<xsl:value-of select="$site_strings[@id='page_results']" />
|
||||
<xsl:value-of select="//results/@value" />&xslt=rss
|
||||
</xsl:attribute>
|
||||
<title>
|
||||
<xsl:value-of select="$site_strings[@id='site_name']" />
|
||||
<xsl:value-of select="$locale_strings[@id='rss_separator']" />
|
||||
<xsl:value-of select="//results/@value" />
|
||||
</title>
|
||||
<link>
|
||||
<xsl:value-of select="$site_strings[@id='page_root']" />
|
||||
<xsl:value-of select="$site_strings[@id='page_results']" />
|
||||
<xsl:value-of select="//results/@value" />&
|
||||
</link>
|
||||
<description>
|
||||
<xsl:value-of select="$locale_strings[@id='rss_description_1']" />
|
||||
<xsl:value-of select="//results/@value" />
|
||||
<xsl:value-of select="$locale_strings[@id='rss_description_2']" />
|
||||
</description>
|
||||
</channel>
|
||||
|
||||
<xsl:for-each select="result">
|
||||
<item>
|
||||
<title>
|
||||
<xsl:value-of select="rdf:RDF/cc:Work/dc:title" />
|
||||
</title>
|
||||
<description>
|
||||
<xsl:value-of select="rdf:RDF/cc:Work/dc:description" />
|
||||
</description>
|
||||
<link>
|
||||
<xsl:value-of select="rdf:RDF/cc:Work/@rdf:about" />
|
||||
</link>
|
||||
</item>
|
||||
</xsl:for-each>
|
||||
|
||||
</rdf:RDF>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
|
@ -34,7 +34,7 @@
|
|||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="site_strings" select="document('../site/main.xml')//strings/str" />
|
||||
<xsl:variable name="site_strings" select="document('../site/main.xml')//strings/string" />
|
||||
<xsl:variable name="locale_strings" select="document(concat('../locale/', $locale, '.xml'))//strings/string" />
|
||||
|
||||
<!-- this kills 99% of the processed XML... sorry Tim Bray.... -->
|
||||
|
@ -53,27 +53,42 @@
|
|||
<head>
|
||||
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="not(//@embed='true')">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="//@stylesheet" />
|
||||
</xsl:attribute>
|
||||
</link>
|
||||
</xsl:when>
|
||||
<xsl:when test="//@embed='true'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="not(//@embed='true')">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="//@stylesheet" />
|
||||
</xsl:attribute>
|
||||
</link>
|
||||
</xsl:when>
|
||||
<xsl:when test="//@embed='true'">
|
||||
<!--
|
||||
embedded stylesheet should rather be done through URL like
|
||||
"http://localhost/video/4chan%20city/3/embed=true+stylesheet=embedded.css"
|
||||
embedded stylesheet should rather be done through URL like
|
||||
"http://localhost/video/4chan%20city/3/embed=true+stylesheet=embedded.css"
|
||||
-->
|
||||
<link rel="stylesheet" type="text/css">
|
||||
<xsl:attribute name="href">
|
||||
/style/embedded.css
|
||||
</xsl:attribute>
|
||||
</link>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<link rel="stylesheet" type="text/css">
|
||||
<xsl:attribute name="href">
|
||||
/style/embedded.css
|
||||
</xsl:attribute>
|
||||
</link>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
<xsl:if test="boolean(//results)">
|
||||
|
||||
<link rel="alternate" type="application/rss+xml">
|
||||
<xsl:attribute name="title">
|
||||
<xsl:value-of select="//results/@value" />
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="$site_strings[@id='page_root']" />
|
||||
<xsl:value-of select="$site_strings[@id='page_results']" />
|
||||
<xsl:value-of select="//results/@value" />&xslt=rss
|
||||
</xsl:attribute>
|
||||
</link>
|
||||
|
||||
</xsl:if>
|
||||
|
||||
<title>
|
||||
<xsl:choose>
|
||||
|
@ -89,6 +104,10 @@
|
|||
"<xsl:value-of select="//resultspage/@query" />"
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!--
|
||||
this seems to be fail
|
||||
should be fixed somehow
|
||||
-->
|
||||
<xsl:value-of select="$site_strings[@id='site_name']" />
|
||||
-
|
||||
<xsl:value-of select="$site_strings[@id='site_motto']" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns="http://xspf.org/ns/0/"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
|
@ -8,8 +8,6 @@
|
|||
>
|
||||
|
||||
<xsl:output
|
||||
doctype-public="-//W3C//DTD XHTML 1.1//EN"
|
||||
doctype-system="http://xspf.org/ns/0/"
|
||||
encoding="utf8"
|
||||
indent="yes"
|
||||
method="xml"
|
||||
|
@ -17,9 +15,6 @@
|
|||
omit-xml-declaration="no"
|
||||
/>
|
||||
|
||||
<xsl:variable name="site_strings" select="document('../site/main.xml')//strings" />
|
||||
<xsl:variable name="locale_strings" select="document(concat('../locale/', $locale, '.xml'))//strings/string" />
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates />
|
||||
</xsl:template>
|
||||
|
@ -55,4 +50,5 @@
|
|||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
Loading…
Reference in a new issue