Skip to content

ddiToXlsform: a <var> without @ID is reported as "no <var>" #170

Description

@jstet

ddiToXlsform rejects a <var> that has no ID, and the message says there is no <var> at all.

ddiToXlsform('<var name="x"><qstn responseDomainType="text"><qstnLit>Hi</qstnLit></qstn></var>')
// ConversionError ddi-invalid: The input holds no <codeBook> and no <var>.

ddiToXlsform('<var ID="V1" name="x"><qstn responseDomainType="text"><qstnLit>Hi</qstnLit></qstn></var>')
// { survey: [{ type: 'text', name: 'x', label: 'Hi' }], … }

(v0.7.0, found through qwacback's POST /api/convert/ddi-to-xlsform.)

Why it matters

  • DDI 2.5 makes var/@ID optional, so this is valid DDI. The ddi2xlsform README says it "never refuses DDI it can parse".
  • The message sends users looking for the wrong problem: the <var> is there.

Suggestion

Read a var without ID, falling back to @name where an ID is needed (varGrp/@var can't refer to it anyway). If it has to be refused, name the reason, e.g. "<var name=\"x\"> has no ID".

Low priority: everything formtransform writes has IDs, and so do qwacback's seeds.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions