XSLT policy to convert attributes into proper case format



By: emarinus

August 6, 2008 1:26 am

Reads: 212

Comments:0

Rating:0

The attached XSLT Policy can be modified to handle specific attributes and for each attribute can be specified if it should be lower-, upper-, or titlecase (each first letter of each word uppercase) format.

The policy contains 2 important variables:

  1. attr-config
    Attr-config acts as an XML array and contains all attributes that need to be converted together with the format they need to be converted into.

    <xsl:variable name="attr_config">
               <attr name="STATUS">title</attr>
               <attr name="ACHTERNAAM">title</attr>
               <attr name="VOORLETTERS">upper</attr>
               <attr name="TUSSENVOEGSELS">title</attr>
               <attr name="ROEPNAAM">title</attr>
               <attr name="VOORNAMEN">title</attr>
               <attr name="GESLACHT">upper</attr>
               <attr name="EMAIL_ADRES">lower</attr>
               <attr name="CODE_LAND">upper</attr>
               <attr name="NAAM_LAND">title</attr>
               <attr name="STRAAT">title</attr>
               <attr name="POSTCODE">upper</attr>
               <attr name="PLAATS">title</attr>
    </xsl:variable>
    
    

    In the above example the STATUS attribute is converted into title-case, the ACHTERNAAM attribute into upper-case and so on. Just add more attribute – value pairs into the list to extend the number of attributes (or delete attributes if you like).

  2. capitalafter
    The capitalafter variable contains characters after which a capital is converted. In most cases it contains just a whitespace character, but in some countries words like ‘Hendrik-Ido-Ambacht’ (which is a Dutch city) or names like ‘Mary-Jose’ must be converted properly to. For these exceptions you can adjust the capitalafter variable.

    <xsl:variable name="capitalafter"> -.</xsl:variable>
    
    

The rest is done for you.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Tags:
Categories: Uncategorized

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.

Comment