Created
September 6, 2013 16:07
-
-
Save anonymous/6466013 to your computer and use it in GitHub Desktop.
Revisions
-
There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ <data> <entry> <caption mode="formatted"> <p>A fairly long looking <a href="http://www.stackoverflow.com">caption with a link</a> that goes to an external site.</p> </caption> </entry> <entry> <caption mode="unformatted"> <![CDATA[A fairly long looking <a href="http://www.stackoverflow.com">caption with a link</a> that goes to an external site.]]> </caption> </entry> </data> 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl"> <xsl:include href="https://gist.github.com/andrewminton/6465924/raw/72d6f6833a282da5ef0d2a8aa22087f71150a59e/nodetostring" /> <xsl:output method="xml" indent="yes" /> <xsl:template match="/"> <xsl:apply-templates select="data/entry"/> </xsl:template> <xsl:template match="data/entry"> <xsl:variable name="html-ready"> <xsl:apply-templates select="caption/*"/> </xsl:variable> <!-- process contents of caption node--> <!-- stringify it --> <li> <xsl:copy-of select="$cap"/> //outside of attribute it works <img> <xsl:attribute name="src">/image/2/150/112/5<xsl:value-of select="@path"/>/<xsl:value-of select="filename"/></xsl:attribute> <xsl:attribute name="data-caption"> <xsl:call-template name="nodetostring"> <xsl:with-param name="node" select="$html-ready"/> <xsl:with-param name="esc-dblq" select="true()"/> </xsl:call-template> </xsl:attribute> </img> </li> </xsl:template> </xsl:stylesheet>