Loading ...
Sorry, an error occurred while loading the content.

Re: [XSL-FO] Utility to populate a schema tree to produce an example instance document

Expand Messages
  • G. Ken Holman
    ... This is not nearly as straightforward as it sounds. ... It isn t a tree walker that you need, it is a schema walker. Because the Universal Business
    Message 1 of 2 , Sep 5, 2006
    • 0 Attachment
      At 2006-09-06 10:51 +1000, hedley.finger@... wrote:
      >For anybody designing XSLT or XSL:FO, a utility that took a given XML
      >Schema or DTD and parsed it to generate an instance document that
      >contained every possible leaf and inserted sample content in content
      >elements such as <p> [paragraph] would be very useful. You could use it
      >to generate an instance of the source and destination document for both
      >developing transform rules and testing the resulting XSL/XSLT/XSL:FO
      >output.
      >
      >Does anybody know of such an utility?

      This is not nearly as straightforward as it sounds.

      >As a non-programmer, I don't have
      >the knowledge or skill to develop a tree-walker which could output
      >instance documents.

      It isn't a tree walker that you need, it is a schema walker.

      Because the Universal Business Language document
      schemas are regularly formed based on
      programmatic generation from strict naming and
      design rules, I was able to write a rudimentary
      schema walker in Python (not released) to produce
      an enumeration of the XPath address for all
      possible information items. I then produced an
      XML instance with one of everything and I
      populated each information item with the ordinal
      of the XPath address for that item. This
      provides a kind of audit trail when using the
      "one of everything" instance as the input to formatting.

      So, your idea is very workable and produces
      meaningful and useful results ... you can review my paper from 2003:

      http://www.idealliance.org/papers/dx_xml03/papers/04-05-02/04-05-02.html

      You can see in section 6 the picture of a PDF
      file created using XSLT and XSL-FO that formatted
      my "one of everything instance using the ordinals
      of the enumerations", thus I was able to visually
      confirm the successful functionality of my stylesheets.

      In fact, the process works very well backwards to
      as a method of writing a formatting
      specification: I gave the XPath file
      enumerations to a subject matter expert who then
      drew the required form and populated it with her
      reckoning of which information items were needed,
      indicated by her use of the ordinals in the
      boxes. I then took that as if it were a
      specification, wrote the transformation in XSLT
      and XSL-FO, and I knew my transformation was
      correct when my formatted result exposed the
      identical set of ordinals as specified by the subject matter expert.

      The success of this approach triggered the
      conference paper and the sharing of the ideas and
      how well it works for us in UBL.

      Where to get a general purpose schema walker? I
      figured that instance editors must be able to
      walk schemas, and I'm sure many (most?)
      commercial XML editors provide an option that
      creates a "one of everything instance" ... though
      the content of these information items is quite
      arbitrary, unlike what I did for UBL by
      populating each information item with its respective XPath ordinal.

      However, talking with one of the companies
      (thanks George!) it was shown to me quite
      obviously that my enumerations of XPath files
      cannot be generated in the general case. It
      happens just that the stars align for UBL schemas
      that I was able to do this. I abandoned pursuing
      these concepts for schemas in the general case.

      Hopefully you will be able to nurture your idea
      with some of the concepts you'll see in my
      paper. I've successfully maintained all of these
      concepts with even the latest UBL 2.0 draft work
      (I republish the XPath files with every new
      release of schemas) and will be continuing to
      deploy all these concepts when I write the
      stylesheets for UBL 2.0. It works well with new
      subject matter experts and they can easily
      understand how to convey to me what they need
      transformed in a form. We only had 8 document
      types in UBL 1.0 and we will have 31 document
      types in UBL 2.0 ... I cannot see any other way
      we might be able to attack this amount of work.

      I hope this helps, Hedley ... good luck in your
      research. Please share what you find.

      . . . . . . . . . . . . . Ken

      --
      UBL/XML/XSLT/XSL-FO training: Vårø, Denmark 2006-10-02/06,11-20/24
      UBL International 2006 2006-11-13/17 http://www.ublconference.com
      World-wide corporate, govt. & user group UBL, XSL, & XML training.
      G. Ken Holman mailto:gkholman@...
      Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
      Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
      Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/f/bc
      Legal business disclaimers: http://www.CraneSoftwrights.com/legal
    Your message has been successfully submitted and would be delivered to recipients shortly.