Originally posted by vivek srivastava:
But where do we define (say) <xsl:for-each select definitions. There should be some place where we define these element�s definition (like for-each) for http://www.w3.org/1999/XSL/Transform name space.
Or is it like all these things are defined in xsl implementation java classes.
The semantics of the XSLT elements are defined in the
XSLT 1.0 and
XSLT 2.0 specifications. Those specifications are implemented in the Java XSLT engines (like Saxon) - so there is nothing to "add". The Java engine looks for
fully qualified XSLT elements. For example an XSLT engine knows what to do with a {http://www.w3.org/1999/XSL/Transform}for-each element (note: the specification uses xsl:for-each for convenience only; the actual, fully qualified name is {http://www.w3.org/1999/XSL/Transform}for-each).
My java program is giving error. Is it like my java program check for this string (http://www.w3.org/1999/XSL/Transform) and if it doesn�t fine any show error? But where does java check that the name space should match with the correct value.
The XSLT engine is looking for {http://www.w3.org/1999/XSL/Transform}for-each - your document contains {vivek}for-each - a totally different element that has nothing to do which XSLT.
Do you use java.lang.String objects in your Java programs and then suddenly refer to com.vivek.String objects and expect the com.vivek.String objects to come from nowhere and behave like java.lang.String objects? That is what you are essentially expecting XSLT to do.
With xmlns:xsl="http://www.w3.org/1999/XSL/Transform" you are saying that "xsl:" of "xsl:for-each" actually stands for "http://www.w3.org/1999/XSL/Transform" so that every time you mean "{http://www.w3.org/1999/XSL/Transform}for-each" you can actually write "xsl:for-each".
With xmlns:xsl="vivek" "xsl:for-each" actually stands for "{vivek}for-each" which means absolutely nothing to XSLT.