Created
March 31, 2010 06:27
-
-
Save LeifW/350008 to your computer and use it in GitHub Desktop.
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 version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom"> | |
<xsl:template match="atom:entry"> | |
<xsl:for-each select="atom:link[@rel='enclosure']"> | |
<xsl:apply-templates select=".." mode="copy"> | |
<xsl:with-param name="enclosure" select="position()"/> | |
</xsl:apply-templates> | |
</xsl:for-each> | |
</xsl:template> | |
<xsl:template match="atom:entry" mode="copy"> | |
<xsl:param name="enclosure"/> | |
<xsl:copy> | |
<xsl:apply-templates select="@*|node()"/> | |
<xsl:copy-of select="atom:link[@rel='enclosure'][$enclosure]"/> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="atom:link[@rel='enclosure']"/> | |
<!-- Identity template --> | |
<xsl:template match="@*|node()"> | |
<xsl:copy> | |
<xsl:apply-templates select="@*|node()"/> | |
</xsl:copy> | |
</xsl:template> | |
</xsl:stylesheet> |
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 -version=1.0 -xmlns:xsl=http://www.w3.org/1999/XSL/Transform -xmlns:atom=http://www.w3.org/2005/Atom | |
template atom:entry | |
for-each atom:link[@rel='enclosure'] | |
apply-templates .. copy | |
with-param enclosure position() | |
template atom:entry -mode=copy | |
param enclosure | |
copy | |
apply-templates @*|node() | |
copy-of atom:link[@rel='enclosure'][$enclosure] | |
template atom:link[@rel='enclosure'] | |
-- Identity template | |
template @*|node() | |
copy | |
apply-templates @*|node() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment