Enforcing character case in a context variable or string
search cancel

Enforcing character case in a context variable or string

book

Article ID: 42888

calendar_today

Updated On:

Products

STARTER PACK-7 CA Rapid App Security CA API Gateway

Issue/Introduction

Solution

Background

The CA API Gateway can use XSL transformations?to manipulate strings in various ways. It may be necessary to case the characters in a string or context variable to either all upper-?or lowercase. A stylesheet can be used to modify non-XML messages using XSL transformations. This methodology can be used in a service policy to manipulate non-XML strings.

Resolution

The following stylesheet can be used to force character casing for a particular context variable or string:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
?? ?<xsl:output omit-xml-declaration="yes"/>
?? ?<xsl:param name="foo"/>
?? ?<xsl:template match="/">

? ??? ??<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'"/>
?? ? ? ?<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
? ? ? ? <xsl:value-of select="translate($foo,$uppercase,$lowercase)"/>?? ??? ?
?? ?</xsl:template>
</xsl:stylesheet>

The value of the?foo?context variable as set in the published service policy will be transformed from lowercase to uppercase. The values?$uppercase?and?$lowercase?in the?value-of?element can be swapped in order to transform from uppercase to lowercase. A sample policy that sets a context variable and executes a case change is attached to this article.

Attachments:

Environment

Release:
Component: APIGTW

Attachments

1558534544077TEC0000001413.zip get_app