Typo . Should be "fn:substring(../personName, 1, 15)" ________________________________ From: Beckerle, Mike <mbecke...@tresys.com> Sent: Tuesday, May 26, 2020 12:47 PM To: users@daffodil.apache.org <users@daffodil.apache.org> Subject: Re: How to use truncateSpecifiedLengthString?
Interesting requirement. So you want it to accept when parsing any length but unparsing is not symmetric with that, it wants to truncate. Presumably this is delimited on parsing, so that it can accept all the characters at parse time. Hmmm. I think this is going to require you to use inputValueCalc and outputValueCalc. Something like this: <element name="storedName" type="xs:string" dfdl:outputValueCalc='{ fn:substring(../name, 1, 15) }' ... plus other properties .... /> <element name="personName" type="xs:string" dfdl:inputValueCalc='{ ../storedName }' /> ________________________________ From: Roger L Costello <coste...@mitre.org> Sent: Tuesday, May 26, 2020 12:40 PM To: users@daffodil.apache.org <users@daffodil.apache.org> Subject: How to use truncateSpecifiedLengthString? Hi Folks, My input contains this person's last name: Wolfeschlegelsteinhausenbergerdorff I want parsing to generate: <personName>Wolfeschlegelsteinhausenbergerdorff</personName> I want unparsing to truncate the name after 15 characters. It would seem that I should use truncateSpecifiedLengthString="yes" to indicate that the name should be truncated. But how to specify that the name should be truncated after 15 characters? I cannot use length="15" because that would cause parsing to fail. /Roger