Search
Categories

Entries in DXL (3)

Thursday
11Feb2010

Complete Turnkey NSF to Transform DXL into XPage Syntax

I posted an entry earlier this week on an update to the stylesheet I created and demonstrated at Lotusphere on how to transform Domino Form, Sub-Form and Shared Fields DXL into XPage syntax that could be copied and pasted directly into the XPages source tab in the Domino Designer client.

I had updated it to include the processing of Sub-Forms and Shared Fields.  The problem was that it placed the fields from the sub-forms and shared fields at the bottom of the XPage instead of in-line where the sub-forms and shared fields appeared in the original Domino Form design.  Well I'm happy to announce two things.

  1. I have updated the Stylesheet so that it processes Sub-Forms and Shared Fields In-Line.
  2. I created a compete turnkey Notes based application that allows developers to complete the transformations and save the results.

In updating the style sheet I was not pleased with the procedure for having to select the design elements from the dialog box in the designer client.  You couldn't tell from one selection to the next what you had selected and the results were not saved, but displayed in the browser.

In the turnkey Notes application I have made available on my download site today I have created a Form that allows developers to choose an application from their local system or a server, select the Forms, Sub-Forms and Shared Fields to be transformed and simply click an action in the action bar to perform the transformation and save the results in a document in the application.

Everything is included in the application.  Nothing else needs to be downloaded.

The individual stylesheet is available for download as well if you don't want to download the complete application.

Here is a summary of the new steps.

You will need an 8.5 or 8.5.1 system.

Download the application from my website to your local data directory and sign it with your ID

Open the application and click on the "Create New Exporter" action in the action bar.

 

This will load the following form where you can select the design elements to be included in the transformation.  The ConvertForm stylesheet is currently the only one included but this design allows for any number of stylesheets to be added and used.  Once all the elements are selected click on the "Run DXL Transformation" action in the action bar.

 

This will transfrom the selected elements and save them in a docment in the "Transformed XPage Results View"

This document can be opened and the XPage syntax copied to the clipboard using the button in the form.

 

Then open an XPage in the Designer client and replace the existing XPage code on the source tab with the code from the clipboard.

And thats it !!

I have implemented this solution so if there are additional stylesheets I (or you) create in the future they can simply be added as an additional stylesheet to choose from in the stylesheets view.

As always I appreciate any feedback ya'll might have on additions and improvements.

Again the complete turnkey application can be downloaded from here.

Thanks !!!

Monday
02Nov2009

UPDATED for 8.5.1: Transforming Domino Forms into XPages via XSLT 

I have updated the XSLT transformation stylesheet referenced in this article to version 8.5.1.

Version 8.5.1 has overcome some of the issues I originally addressed in that article but has introduced some new ones.

So to recap;

  1. The fields are always added in alphabetical order versus the order they appear on the Domino Form design. (Fixed in 8.5.1)
  2. You have to change the control type to match the one on the Domino form when you drag the fields on the XPage from the data palette or they are all added as Edit Box controls. (This is the same except for date fields)
  3. Computed fields are not brought across at all. (Fixed in 8.5.1)
  4. There was no way to create Radio or Checkbox keyword fields dynamically (The Same)
  5. Keyword field values were not brought across at all (The Same)

So where 8.5.1 has fixed 2 of the original five issues, it introduced another one. In 8.5.1 there is a new control type called a Hidden control. So it would be nice when adding fields to the XPage Design to be able to map the "hidden" fields from the Domino Form to the new "hidden" contol type on an XPage. Unfortunately that option is not one of the available choices from the drop down list.

So I have re-written/updated the Form to XPage transformation style sheet to address these issues.

The updated stylesheet will do everything the previous one did with the following added functionality.

  1. Computed, Computed When Composed and Computed for Display fields are now added to the XPage as a Computed control with any formula vales added to the JavaScipt code window as comments.
  2. Any Hidden Fields on the Domino Form Design (Notes or Web) are added to the XPage as Hidden controls
  3. A default Submit, Cancel and Edit button are added to the end of the XPage

 

 

 

You can download the new stylesheet from my web site here.

Thursday
23Jul2009

Transforming Domino Forms into XPages via XSLT

I have been working with XML/XSLT for a long time and it is one of my favorite technologies to work with.  When developing XPages from existing form designs, or even ones I created to be the data source for a new XPage, there were a couple of things I noticed.

  1. The fields are always added in alphabetical order versus the order they appear on the Domino Form design.
  2. You have to change the control type to match the one on the Domino form when you drag the fields on the XPage from the data palette or they are all added as Edit Box controls
  3. Computed fields are not brought across at all.
  4. There was no way to create Radio or Checkbox keyword fields dynamically
  5. Keyword field values were not brought across at all

So, I found that every time I was adding fields to an XPage I had to

  1. Reorder the fields and Lables in the Table
  2. Add the Computed fields
  3. Change the controls that should be Radio Button and CheckBox controls manually
  4. Populate the choices for the selection type controls.

Ok, so first off let me be clear.  These are NOT difficult or time consuming tasks.  But my theory was if I didn't have to do those things every time then I could concentrate on the development of the XPage logic and not what are mostly mundane tasks.

So here is the premise.  The Domino Form Design can be expressed as XML (DXL officially).  An XPage is nothing more than well formed XML (JSP/JSF syntax).  So why not simply use XSLT (That's already built into the designer client) to transform the Domino Forms DXL output to the XPage XML output on the fly.

So I wrote an XSLT (XML Stylesheet Trasformation) file that will perform the transformation.

One aspect that I like about this current solution is that the XSLT file is installed on the file system and only needs to be accessible by the Domino Designer client.  You then use the existing Tools menu in the Designer client to perform the transformation.  No .nsfs to install, no code to sign etc. 

The following walk through demonstrates how this will work.

Download the XSLT Style sheet from here

Copy it to your <notesInstall>/data/xsl directory

Open the Domino Designer Client

Open the Application that contains the Domino Form to be Transformed

Form the menu choose Tools | DXL Utilities | Transformer...

This will open the DXL Transformer Dialog.  Check one of the forms in the forms list on the left.  Select the "DominoDBDXLtoXPage.xsl" stylesheet from the list on the right(This is the file you downloaded and copied into the data/xsl directory).  Leave the Send output to defaulted to "Display".  Click the "OK" button.

 

This will open the transformed XPage in the Browser (But it will not be displayed as an XPage.  You will see the following in your browser.

 

Right click on the Web Page and choose to view the page source (which is the XPage xsp code)

Select all of the code (ctrl-A) and then copy the code to the clipboard.  Close the View Source window and the web browser window.

Back in the Domino Designer, create a new XPage in the same application that the original Domino Form was transformed from.

 

Switch to the "Source" view.  Delete the Existing Code

 

Paste in the code from the Clipboard.  Hit CTLR-SHIFT-F to format the code.

 

Switch to the Design view to see the controls in design view.

 

Preview the the XPage in your default browser to test the XPage.

The results of the transformation is that a document data source referencing the current application and the selected form are added to the XPage.  A Table is created with a Label created from the field name and a control with the same name and type as from the Domino Form.  Default values are brought across for editable fields.  If it is formula based it is brought across as JavaScript comments so the original logic is retained.

All Static keywords (both values and aliases) are brought across for all the selection type fields.

If there is a control you don't need then simply select the table row in the Outline view and delete it from the right click menu.  My experience has been it is easier to delete the controls I don't need than add the individual computed fields in manually.

It's not perfect and it does not duplicate all of the form logic 100% but gets a lot closer.  I figure the less time I spend editing the more time I have for development.  Work smarter not harder.

My disclaimer (there is always a disclaimer) is that it's still a work in progress.  I will eventually put a UI on it and create the XPage XML from a form where developers can choose what they want to include, change switches etc.  But for now it is a handy tool in my toolbox.  I hope it will help save some XPage developers some time.