Skip to content

Instantly share code, notes, and snippets.

@jcfr
Created October 21, 2011 03:49
Show Gist options
  • Save jcfr/1303051 to your computer and use it in GitHub Desktop.
Save jcfr/1303051 to your computer and use it in GitHub Desktop.
slicer-4.0-module-description.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes" encoding="UTF-8"/>
<xsl:template name="newline"><xsl:text>&#10;</xsl:text></xsl:template>
<!-- Source: http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx -->
<xsl:template name="string-replace-all">
<xsl:param name="text" />
<xsl:param name="replace" />
<xsl:param name="by" />
<xsl:choose>
<xsl:when test="contains($text, $replace)">
<xsl:value-of select="substring-before($text,$replace)" />
<xsl:value-of select="$by" />
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="substring-after($text,$replace)" />
<xsl:with-param name="replace" select="$replace" />
<xsl:with-param name="by" select="$by" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/executable">
<!--<xsl:value-of select="description"/>-->
<!--<xsl:variable name="description" select="description">-->
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="normalize-space(description)" />
<xsl:with-param name="replace" select="'\n'" />
<xsl:with-param name="by" select="'&#10;'" />
</xsl:call-template>
<xsl:call-template name="newline"/>
</xsl:template>
</xsl:transform>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment