XForms Everywhere

11/5/2006

XPath: The Many Faces of a Document

Filed under: General — Alessandro Vernet @ 11:45 pm

Young Women or Old Hag?From time to time, you will come across a function in XPath that returns an XML document. If you are using XSLT 1.0 or 2.0, XPath 2.0, XQuery, or XForms, you will get to use a mix of instance(), doc(), and document(). Let’s start with instance() which you’ll find in XForms.

XForms is a technology used to create forms. The data you enter in the form is stored in one or more XML documents, which in the XForms jargon are called XForms instances. Each document in XForms has an id which can be used to retrieve the document. Here an example of a declaration of an XForms instance:

<xforms:instance id="address">
    <address>
        <street>1 Infinite Loop</street>
        <city>Cupertino</city>
        <state>California</state>
    </address>
</xforms:instance>

Assuming that the document in the instance with id address is also accessible at the URI http://www.example.org/address.xml, consider the following XPath expressions:

  • instance(’address’)
  • doc(’http://www.example.org/address.xml’)
  • document(’http://www.example.org/address.xml’)

All 3 expressions return the same “address” document. You can use first expression with instance() in XForms, the second with doc() wherever you have XPath 2.0 or XQuery expressions, and the third with document() within an XPath expression in XSLT 1.0 or 2.0 stylesheets.

While all 3 return the same “address” document, they don’t return the same node of the document: instance() returns the root element, while doc() and document() return the document node. This means that to point to the street element, you will need to write:

  • instance(’address’)/street
  • doc(’http://www.example.org/address.xml’)/address/street
  • document(’http://www.example.org/address.xml’)/address/street

Note how the name of the root element (”address”) is used with doc() and document() but not with instance(). Granted: the difference between doc()/document() on one side and instance() on the other side is trivial. But it is surprisingly easy to make a mistake when using all these functions in the same day. So keep it mind: the same document can have many faces depending on which function you use.

Orbeon PresentationServer is now Orbeon Forms

Filed under: News — Erik Bruchez @ 12:58 am

Form

We are glad to announce that Orbeon PresentationServer has a new name: Orbeon Forms.

Renaming a product is not something to be taken lightly. However we feel that:

  • Orbeon Forms better reflects the fact that forms have been the main focus of our development efforts over the last two years.

  • This new face will help potential users understand more easily what the platform can do for them.

  • Orbeon Forms is just an easier name to remember!

We are encouraged in this decision by the fact that almost all current users build complex web forms using our Ajax-based XForms engine. The name change also conveys that we plan to keep focusing on form-related capabilities in the future like we have done in the last two years.

It is important to precise the following:

  • We are not creating a separate product: Orbeon Forms is simply a new name for Orbeon PresentationServer.

  • Other XML technologies like XSLT and XML pipelines remain an important part of the platform.

  • And of course, Orbeon Forms remains an open source solution!

We will progressively migrate the web site and documentation to reflect the new name, and we can already point you to our updated home page!

Powered by WordPress