XML Structure – Best Practice

There are several discussions in XSLT development community how to structure the XML to be XSLT friendly.

http://www.xfront.com/GlobalVersusLocal.html

http://www.rpbourret.com/xml/XMLAndDatabases.htm

The classic and widely used approach is to describe Objects using XML:

Russian Doll Structure XML

For example the next XML structure bellow is a sample of nested XML so-called Russian Doll Structure:

OrgChart-RussianDoll-XML-Struct1.png

Russial Doll XML Structure

The main characteristics of the above XML are:

1)       It contains nested objects for example: the <Person> element is contained within the <Department> element which is contained within the <Office> element.

2)       The number of elements, their names, position and attributes are absolutely arbitrary and unique. So as the unique XSLT style sheet is needed for the above XML transformation.

Dataset XML Structure – the right way

The other type of XML is so called Dataset type XML. It represents a database table structure. Like database the Dataset type XML has a very flat structure. The Dataset XML does not have nested elements. It has group of similar elements like on the picture below:

OrgChart-Data-XML-Struct1.png

Dataset XML Structure

If there is an object relationship it can be achieved by using “Parent” pointer like

<row name=”Parent” value=”2″ />

The data content in both cases is absolutely the same. Both XML snippets can be transformed using XSLT into the same HTML result. The difference is that the Dataset typed XML always contains the same flat structure no matter how complex is the data itself. That type of structure gives a huge leverage for the programmers because it allows to create the generic XSL modules that can be imported into working XSLT documents and used like common modules. From one side it will simplify day to day coding tasks by using common templates. From the other side it will allow to create sophisticated parameter based custom HTML controls that can be materialized with few lines of XSLT “<xsl:call-template…/>” function. That approach will also allow to minimize the creation of custom XML – XSLT solutions utilizing generic, common and standard templates created once and for all.

Viagra is the most famous ‘love pill’ in the world, but it is not the only option for you. The majority of men who tried both brand and generic pills state that Cialis (the most famous and top-quality generic drug) works better. It is up to you to decide whether you choose brand pills or buy Cialis, but ED patients state that:
Now it is possible to avoid awkward publicity if you buy Cialis online in our reliable web pharmacy. To purchase Cialis online simply place your order, use your credit card to pay for your pills, cheapest generic cialis online receive your drug per post in a decent package and start your way to perfect men’s health!

This entry was posted in Uncategorized. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>