transform

Top  Previous  Next

- transform ( truncateToMaxLength | toUpperCase | toLowerCase

| trim | ltrim | rtrim | normalize | token

| onlyNumbers | onlyLetters | onlyNumbersAndLetters )

 

Apply certain transforms to the data before it is validated.

 

<Information>

   <!-- will truncate the title to 10 characters such that "Green Eggs and Ham" becomes "Green Eggs" -->

   <Title transform="truncateToMaxLength" maxLength="10">Green Eggs and Ham</Title>

   <!-- such that John becomes JOHN -->

   <Name transform="toUpperCase">John</Name>

   <!-- such that John becomes john -->

   <Name transform="toLowerCase">John</Name>

   <!-- will remove whitespace from the first name such that " John   " will become "John" -->

   <Name transform="trim">John</Name>

   <!-- will remove whitespace from the end of the middle name such that " Jared" becomes "Jared" -->

   <MiddleName transform="ltrim">Jared</MiddleName>

   <!-- will remove whitespace from the end of the last name such that "Doe  " becomes "Doe" -->

   <LastName transform="rtrim">Doe</LastName>

   <!-- A normalized string (one without tabs and line breaks) -->

   <CardHolderName transform="normalize">John</CardHolderName>

   <!-- Convert a normalized string by collapsing consecutive spaces and trimming leading and trailing spaces. -->

   <CardHolderId transform="token">234</CardHolderId>

   <!-- Remove anything that is not a number (55555-1234 becomes 555551234) -->

   <Zip transform="onlyNumbers">55555-1234</Zip>

   <!-- Remove anything that is not a letter (Mn5 becomes Mn)-->

   <State transform="onlyLetters">Mn5</State>

   <!-- Remove anything that is not a number or a letter (MNA34-23342A becomes MNA3423342A) -->

   <LicenseNumber transform="onlyNumbersAndLetters">MNA34-23342A</LicenseNumber>

</Information>

 

 

You can apply multiple transforms as follows:

 

<!-- will truncate the text " Johnathan  " to "John" -->

<Name transform="trim,truncateToMaxLength" maxLength="4"> Johnathan  </Name>