
You could use an assert on the sequence that tested for the allowed combinations? Such an assert is evaluated at the end of the sequence. If you get that far then both the Type and Subtype must have passed their individual asserts. Use fn:upper-case() to handle mixed case. Note that you can't reuse the information in the facets in the assert's expression though. Strictly speaking, this sort of cross-field 'complex' validation is not something DFDL was designed to do. The WG has considered this a post-parse validation step, the sort of thing that folk use Schematron or similar tools to do. Although asserts are designed as a parsing aid, they can be used to do some limited amount of complex validation - and I think this is an example where it would work ok. Let us know how you get on. Regards Steve Hanson Architect, IBM Data Format Description Language (DFDL) Co-Chair, OGF DFDL Working Group IBM SWG, Hursley, UK smh@uk.ibm.com tel:+44-1962-815848 From: "Garriss Jr., James P." <jgarriss@mitre.org> To: "dfdl-wg@ogf.org" <dfdl-wg@ogf.org>, Date: 20/06/2013 16:34 Subject: [DFDL-WG] How to specify type/subtype combos? Sent by: dfdl-wg-bounces@ogf.org Content types come in pairs. So while the type can be “text” and the subtype can be “pdf”, the complete content type cannot be “text/pdf”. It can, however, be “text/html” or “application/pdf”. So in my DFDL it’s not sufficient to specify enumerated lists for types and subtypes (as I have done below), I must also specify which types are allowed to go with which subtypes. How would I do that, given this complexType? TIA! <xsd:complexType name="MimeTypeType"> <xsd:sequence dfdl:separator="/"> <xsd:element name="Type" dfdl:initiator=""> <xsd:annotation> <xsd:appinfo source="http://www.ogf.org/dfdl/dfdl-1.0/ "> <dfdl:assert test="{ dfdl:checkConstraints(.) }" message="The type must match one of the values on the enumerated list."/> </xsd:appinfo> </xsd:annotation> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:pattern value= "([a|A][p|P][p|P][l|L][i|I][c|C][a|A][t|T][i|I][o|O][n|N])| ([m|M][u|U][l|L][t|T][i|I][p|P][a|A][r|R][t|T])| ([m|M][e|E][s|S][s|S][a|A][g|G][e|E])| ([t|T][e|E][x|X][t|T])" /> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="Subtype" dfdl:terminator=""> <xsd:annotation> <xsd:appinfo source="http://www.ogf.org/dfdl/dfdl-1.0/ "> <dfdl:assert test="{ dfdl:checkConstraints(.) }" message="The subtype must match one of the values on the enumerated list." /> </xsd:appinfo> </xsd:annotation> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:pattern value="([p|P][d|D][f|F])| ([a|A][l|L][t|T][e|E][r|R][n|N][a|A][t|T][i|I][v|V][e|E])| ([m|M][i|I][x|X][e|E][d|D])| ([r|R][f|F][c|C]822)| ([p|P][l|L][a|A][i|I][n|N])| ([h|H][t|T][m|M][l|L])" /> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:sequence> </xsd:complexType> -- dfdl-wg mailing list dfdl-wg@ogf.org https://www.ogf.org/mailman/listinfo/dfdl-wg Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU