| Using XML and Relational Databases for Internet Applications | Table of contents | Indexes | XML and Healthcare Vocabularies in Real-world Products | |||
| Cogitech Inc. North Woodmere Ogievetsky, Nikita USA ![]() | Nikita Ogievetsky |
| President |
| Cogitech Inc. |
| 646 Golf Drive
North Woodmere
USA
(11581)
Email: nogievet@offsight.com |
| Biography |
| Computer consultant since 1994. Specialize mainly in data-warehousing with SYBASE and SQL Server. Work with XML since 1997. |
| Maintain http://www.cogx.com a web site devoted to XSLT and XML driven GUI. |
| From 1981 to 1994 worked in the field of Neutrino astrophysics for Russian-German and American-Italian collaborations. |
| Have over 15 publications on computer science, applied math and physics. |
Introduction |
Setting task |
| My team supports data warehouse production operation including adjustment system plus generates financial reports. We wanted a solution that would facilitate all of the following projects: |
XML object template |
| So development of a new web site is minimized to |
| XML template for a fictitious General Ledger is shown in Picture 1. |
|
Approach |
| Once we have XML template we need a mechanism to fuel interactive web pages. |
| We investigated 2 approaches: |
MSXML and dynamic ASP scripts |
| Block scheme of this approach is shown on Picture 2. This approach was presented at GCA Metastructures 99 conference in Montreal. Slides from this presentation are available at http://www.cogx.com/xwtl/presAll.asp. |
|
XT and static server side scripts: House of bricks. |
| A utility written in Python preprocesses XSLT transformations in batch and generates static HTML and ASP pages. No XSLT transformation is happening at the run time. |
| Disadvantage : changes in XML file will be reflected in web pages only after batch transformations are re-processed. |
| Advantage : faster execution because XSLT transformations are not happening on user request. |
| XT implements August 1999 XSLT Working Draft. This means that we can modularize approach even further: |
|
| Now each screen can be built out of 3-4 xsl:template-call elements. For example Search Entry Screen has |
| Sea picture 4. Insert Entry screen also has all fields enabled, initiated with defaults values if any. |
|
| When search query is submitted, search results screen fetches all records that matches search criteria. When a record is selected for update, its unique identifier marked in XML template bypk attribute is sent to theUpdate Entry screen. Update Entry screen: |
|
| When user decides to commit update, server side script: |
| Sea picture 6. |
|
| On pictures 4,5,6FORM template has two parameters : |
| enabled with possible values: |
| value-set with possible values: |
| Using proprietaryxt:document extension we can combine stylesheets for all screens in one stylesheet-city. XLink in this scenario is transformed into a collection of static web pages with hyperlinks (or buttons playing roles of hyperlinks). As XT reads site map, it generates screens only for roles designated to this web site. This is determined by xlink:locator elements. Links are generated according to xlink:arc elements. Extending our metaphor, extended link is a map used to build web site-city from screens-houses constructed from xsl:template-bricks and connected by xlink:arc-streets. Sea picture 7. It corresponds to XML template shown on Picture 1. |
|
| Picture 8 shows template generating links as buttons. |
|
| Picture 9 shows template-wrapper that adds all the necessary HTML tags and writes HTML or ASP page. In the case of ASP it adds common server-side JavaScript functions. |
|
XSLT Constructor game |
| To demonstrate merits of our approach let us build a new screen from existing blocks. Some times, especially in the case of de-normalized data structure, one have to add a new record with most of the fields equal to fields of an existing one. In this case a cloning mechanism makes sense. User can clone a record selected on a search screen, or clone just inserted or updated record. Clone screen: |
| Clone screen is similar to edit screen. Differences: in edit screen pk fields are disabled, in clone screen all fields are enabled, edited record is inserted, not updated. To add this new screen to a web we have to add one locator and five arcs to the xity map. See picture 10: |
|
| Picture 11 shows the main blocks used to build new clone screen. Compare it to blocks used for edit (update entry) screen in picture 5: |
|
| Picture 12 shows xity map after the new clone screen is added: |
|
Sample templates |
| Links template was shown on picture 8. Entry/Display Form template from presentation layer is shown in picture 13. |
|
| Form template usesrs-value and rs-selected templates defined in API layer. They can be replaced if a different database API is used. In other words for template library to work, API stylesheet should exposers-value andrs-selected templates. So we are back to defining interfaces. Picture 14 showsrs-value and rs-selected templates for ASP and ADO. |
|
| Update is another template that API stylesheet should expose in its interface. It creates and executes update statement.Update template used in our case is shown on picture 15. |
|
| <SS> tag should be replaced withserver side script tag. Update template uses internal templates "methods": |
| _where-pk builds where clause by pk fields, |
| _qfvalue writes a form string value surrounded by quotes in case of character fields. |
| _last-coma puts a coma separator everywhere but after the last node. |
| This templates along with subsequently referred _fvalue and _last-and templates are shown in picture 16. |
|
| At last Python wrapper is shown in picture 17. It starts XT XSLT processor which outputs web pages with html method (see picture 9). There is some clean-up needs to be done to make valid ASP pages: |
|
| You can find other details and source code at http://www.cogx.com You are welcome to make your own developments and add new bricks and blocks to Xity constructor. Add your URL or post your examples at http://www.cogx.com/xwtl/links.asp |
Conclusions |
| UsingXSLT web template library with Xity constructor allows separation of development process into four layers: |
|
| High level of modularization allows developers to change only one of the layers living others as untouched. |
| Object (table) structure is described in XML so there is no need to hardcode table field properties in server side scripts or retrieve them dynamically in run-time from the database, thus simplifying code maintenance and reducing number of database calls. |
| XML based and hence easy integration with other systems and extensible. |
| Client requirements: any HTML4 aware browser. Simplified user training and client installation. |
References |
|
| Using XML and Relational Databases for Internet Applications | Table of contents | Indexes | XML and Healthcare Vocabularies in Real-world Products | |||