Search code examples
xslt

In an XSLT template, I need to prefix names with a "'l" if they start with a vowel


In the XSLT template I will expand an input variable like this: <xsl:value-of select="$ClubName" /> But if that $ClubName starts with a vowel, I need to prefix with l'

I think there may be a regular expression technique to do this.


Solution

  • In xslt 1.0 you could try this:

      <xsl:if test="contains('AEIOUaeiou',substring($ClubName,1,1))">
        <xsl:text>l'</xsl:text>
      </xsl:if>
      <xsl:value-of select="$ClubName"/>