-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
planet-php
committed
Jan 8, 2010
1 parent
ee9d1bf
commit b6b71f9
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0"?> | ||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:php="http://php.net/xsl" | ||
> | ||
<xsl:output method="xml" indent="no" omit-xml-declaration="no"/> | ||
|
||
<xsl:param name="cb" /> | ||
|
||
|
||
<xsl:template match="/"> | ||
<xsl:if test="$cb != '0'"> | ||
<xsl:value-of select="$cb"/>( | ||
</xsl:if>[<xsl:apply-templates select="/planet/entries/entry"/>] | ||
<xsl:if test="$cb != '0'">); | ||
</xsl:if> | ||
</xsl:template> | ||
|
||
<xsl:template match="entries/entry">{"title": <xsl:value-of select="php:functionString('json_encode',title)"/>, | ||
"link": <xsl:value-of select="php:functionString('json_encode',link)"/>, | ||
"author": <xsl:choose> | ||
<xsl:when test="string-length(blog_author) > 0 "> | ||
<xsl:value-of select="php:functionString('json_encode',blog_author)"/> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:value-of select="php:functionString('json_encode',blog_title)"/> | ||
</xsl:otherwise> | ||
</xsl:choose>, | ||
"guid": <xsl:value-of select="php:functionString('json_encode',guid)"/>, | ||
"updated": <xsl:value-of select="php:functionString('json_encode',date_iso)"/>, | ||
"content": <xsl:call-template name="description"/>, | ||
"id": <xsl:value-of select="id"/> | ||
}<xsl:if test="position() != last()">,</xsl:if> | ||
</xsl:template> | ||
|
||
<xsl:template name="description"> | ||
<xsl:choose> | ||
<xsl:when test="string-length(content_encoded) > 0"> | ||
<xsl:value-of disable-output-escaping="yes" select="php:functionString('json_encode',content_encoded)"/> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:value-of disable-output-escaping="yes" select="php:functionString('json_encode',description)"/> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:template> | ||
</xsl:stylesheet> |