Search code examples
xmlcontent-management-systemxforms

Web-based structured document authoring solution


I’m looking for a web-based structured document authoring solution for very varied document types and therefore very different content models. Many, but not all, documents are similar to magazine articles with top-level metadata such as keywords, author and title then a series of ordered sections of various types that may contain other sections.

The content is continually evolving so new document types need to be created fairly frequently. The requirement is that document templates themselves can be defined using an authoring system (rather than being hard-coded software).

I was recommended to look at Xforms-based solutions such as betterForm, XSLTForms and Orbeon, where Xforms can be created to define the document templates and then XML documents can be created using the Xforms.

I get that XRX is a great idea and everything stays within the bounds of XML technologies, but while there’s some really nice user interfaces to create Xforms and then use those Xforms to create XML documents, it looks to me like Xforms won’t support ordering and nesting of different choosable section types.

Any suggestions would be greatly appreciated.

Edit:

I've been looking more closely into Xforms technology and come to the conclusion that using it to author the type of structured documents I need to create is not what it was designed for.

Specifically, I have documents with repeating polymorphic sections: for example, I have an article with sections. I want to add, remove, re-order and remove sections. For each section I want to choose if the next section is a text section or an image section or a quote section, etc. I may want to change a text section to an image section.

If I choose to use Xforms to achieve this, it means I essentially need to dynamically rewrite the underlying Xforms markup at runtime to create a bespoke template for my document, with all the correct types of section laid out for my particular article, in this case.

While XForms provides elements such as xforms:repeat and xforms:switch, the lack of native support for dynamic manipulation of the form structure at runtime, along with no native mechanism to model inheritance (whereas XML Schema has abstract types) makes modelling polymorphic content very difficult and it's unlikely any out-of-the-box Xforms solution exists and moreover building a bespoke web application (which is not out of the question) would still be a struggle.

Correct me if I'm wrong!


Solution

  • Ordering is not natively supported in XForms but it's possible to implement it with something like this:

    <xf:group ref="preceding-sibling::*[1]">
      <xf:trigger>
        <xf:label>Move Up</xf:label>
        <xf:action ev:event="DOMActivate">
          <xf:insert nodeset="self::*" origin="following-sibling::*[1]" position="before"/>
          <xf:delete nodeset="following-sibling::*[1]"/>
        </xf:action>
      </xf:trigger>
    </xf:group>
    <xf:group ref="following-sibling::*[1]">
      <xf:trigger>
        <xf:label>Move Down</xf:label>
        <xf:action ev:event="DOMActivate">
          <xf:insert nodeset="self::*" origin="preceding-sibling::*[1]" position="after"/>
          <xf:delete nodeset="preceding-sibling::*[1]"/>  
        </xf:action>
      </xf:trigger>
    </xf:group>
    

    Nesting can be performed in a similar way.

    When creating a structure, it is currently required to have defined this structure in a work instance to be able to copy it. Adding nodes without copying them would require extra functions.

    -Alain