There is no functionality to do what you want in the BizTalk mapper - you could certainly write some sort of pre or post processor that would do this but I'd suggest you are going down the wrong path.
It will take more work but I'd advise investigating why your source and target systems have such different schemas. It is probably a warning sign that you want to truncate so many fields to be able to pass information on.
It will be well worth your time to work out:
- Are these maxLength elements all strictly necessary?
- Will truncation of any of your fields cause issues, either technically or to business users?
- Should some of these fields instead be being split up? Perhaps one system defines a single 100 character address field, while the other system has a street and a town field.
The maxLength property defines how long an element content can be. So yes, it's only purpose is to provide additional validation rules for your schema.
From the W3C XML Schema definition:
maxLength· provides for:
•Constraining a ·value space· to
values with at most a specific number
of units of length, where units of
length varies depending on {base type
definition}.
I prefer the word they use constraining over the word validation
- to me this more clearly expresses the concept of your XML schema being a contract that defines what your system will be passing to other systems. Facets like maxLength say (to the reader of the schema) that systems hoping to consume this data may well break if they are passed anything longer than the maxLength.