-
-
Save andrewminton/2f990e788c34129b674a 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
<data> | |
<hello>paste your xml here</hello> | |
<p>Image.jpg</p> | |
<p>This is some text I don't want to convert .jpg</p> | |
</data> |
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
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:output method="xml" indent="yes" /> | |
<xsl:template match="/"> | |
<hi> | |
<xsl:value-of select="data/hello" /> | |
</hi> | |
<xsl:apply-templates select="data/p" mode="ninja"/> | |
</xsl:template> | |
<xsl:template match="data/p" mode="ninja"> | |
<p> | |
<xsl:choose> | |
<xsl:when test="contains(.,'.jpg')"> | |
<img src="{concat('http://imgur.com/',text())}"/> | |
</xsl:when> | |
</xsl:choose> | |
</p> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment