Skip to content

Instantly share code, notes, and snippets.

@SebDeclercq
Last active October 15, 2019 14:20
Show Gist options
  • Save SebDeclercq/93c3ce61d8324c41eb695923975e167a to your computer and use it in GitHub Desktop.
Save SebDeclercq/93c3ce61d8324c41eb695923975e167a to your computer and use it in GitHub Desktop.
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output
method="xml"
encoding="UTF-8"
indent="yes"/>
<xsl:template name="ola" match="/">
<xsl:param name="string" select="'hello world'"/>
<xsl:param name="idx" select="1"/>
<xsl:if test="string-length($string) &gt;= $idx">
<xsl:element name="ola">
<xsl:value-of select="substring($string, 0, $idx)"/>
<xsl:value-of select="translate(
substring($string, $idx, 1),
'abcdefghijklmnopqrstuvwxyz',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
)"/>
<xsl:value-of select="substring($string, $idx + 1)"/>
</xsl:element>
<xsl:call-template name="ola">
<xsl:with-param name="idx" select="$idx + 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<ola>Hello world</ola><ola>hEllo world</ola><ola>heLlo world</ola><ola>helLo world</ola><ola>hellO world</ola><ola>hello world</ola><ola>hello World</ola><ola>hello wOrld</ola><ola>hello woRld</ola><ola>hello worLd</ola><ola>hello worlD</ola>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment