After a long stretch of work in XQuery in a leading COTS product, I have come up with below XQuery design guidelines for reference. However, the actual implementation might be based on the product terminologies or the standard you are following. I think that the below can be applied to any implementation of XQuery.
So below are the design principles:
Whitespaces are good
When it comes to writing XQuery, a simple language it can become lengthy over a period of time. In case you intend to be the sole owner, care taker and modifier of the XQuery and you are perfectly fine with how your XQuery looks, then it is ok to have a XQuery like a paragraph. Otherwise, please MAKE USE OF THE WHITESPACE. It is a small character but its like a perfume to XQuery. Lets see how.
Below is a small XQuery:
And now, lets add some perfume to it. this is how it looks:
I prefer the second one.
Watch this space for more.
Shuvamoy says
Great work.. Would request you to come up with coding practices for Xquery for review work that can be used as standard for any xquery project.