It appears the answer is: No.

You might think that the SSN pattern could be expressed this way:

dfdl:textNumberPattern="###,##,####"
dfdl:textStandardGroupingSeparator="-"

That is, a SSN is a group of 3 digits followed by a group of 2 digits followed 
by a group of 4 digits, where the groups are separated by dashes.

However, that doesn't work. Here's why.

>From the DFDL specification:
-----------------------------------------------------
If a dfdl:textNumberPattern contains multiple grouping separators, the interval 
between the last one and the end of the integer defines the primary grouping 
size, and the interval between the last two defines the secondary grouping 
size. All others are ignored, so "###,##,####" == "##,##,####"
-----------------------------------------------------

Thus, this SSN:

123-45-6789

is parsed to this:

<SSN>123456789</SSN>

and unparsed to this:

1-23-45-6789

Eek! The parse is what is desired, unparse is not.

Here's the DFDL that I used:

<xs:element name="ssn" type="xs:unsignedInt"
    dfdl:textNumberRep="standard"
    dfdl:textNumberCheckPolicy="lax"
    dfdl:textNumberPattern="###,##,####"
    dfdl:textStandardGroupingSeparator="-"
    dfdl:textStandardDecimalSeparator="."
    dfdl:textStandardBase="10"
    dfdl:textNumberRounding="pattern"
/>

Reply via email to