Sunday, November 26, 2006

XML hints

These are some things needed to know about xml.....

Fact 1:
Comments should not have '--' in between.. This is a very common knowledge but what is not so common knowledge is that '--->' is an invalid end of comment.

Fact 2:
Do you know about dtd entities?

<!ENTITY copyright SYSTEM "">

You define a dtd entity and then it can be used in the dtd anywhere, its like a constant being declared.

It can be used in xml as:-

Fact 3
Now whats the difference between a/b and a[b] in XPath?

a/b selects the node b which is a child of node a.
a[b] selects node a which has a child b.

The difference is very subtile but the node selected is different.

Fact 4
What does the translate function in XSLT do:-

will result in:-


Fact 5

Stylesheet Inclusion
It is an error if a stylesheet directly or indirectly includes itself.

Including a stylesheet multiple times can cause errors because of duplicate definitions. Such multiple inclusions are less obvious when they are indirect. For example, if stylesheet B includes stylesheet A, stylesheet C includes stylesheet A, and stylesheet D includes both stylesheet B and stylesheet C, then A will be included indirectly by D twice. If all of B, C and D are used as independent stylesheets, then the error can be avoided by separating everything in B other than the inclusion of A into a separate stylesheet B' and changing B to contain just inclusions of B' and A, similarly for C, and then changing D to include A, B', C'.

This can be tested by having templates of the same name in all the stylesheets and play around with importing the style sheets. Thus u'll notice
1. the curent style sheet takes the precidence
2. if more than one stylesheets are included then the last one imported takes precidence.


The start

I created the blog to talk about the technologies and other things I work in. I have worked on some technologies and languages that include EJB, java, Delphi, Struts, Hibernate, Spring, Ajax, Web Services, SOA. I have a little understanding on C#. Right now I am working on SOA and related technologies, thus most of the blogs I put will be related to XML, Web Services, BPEL or the ESBs.