90 The XML Files: Develo pment of XML/XSL A pplications Using WebSp here Studio

Editing an XSL file

The XSL editor provides a text editor to handle the source code of the XSL file. It
has several text editing features, such as content assist and syntax highlighting.
The content assist feature helps you in writing you XSL code, as it is aware of the
proper XSL grammar rules. When editing the XSL docum ent, content assist can
be invoked to prompt the you with a list of possible XSL constructs to use.
Concerning the syntax highlighting feature, you will notice that whenever you
select any of the XSL file components listed in t he Outline view, the
corresponding XSL code for that component will be selected, and v ice versa.

Validating the XSL file

Another useful feature of the XSL editor, like the rest of the editors, is the
incremental validation feature. At any point during your development of an XSL
file, you can invoke the Validate process to validate the file. Just right-click on the
file name in the Navigator view, and select the Validate XSL File option. In
addition to the manual invocation of the validation process, the validation is also
automatically run when you save the document. Any validation errors will be
reported in the Task view with a little red marker for the corresponding line in the
source code of the XSL file.
5.3 Namespace support
Namespaces are useful when there is a need for elements and attributes of the
same name to take on different meaning depending on the context in which they
are used. So, the XML namespace is the means to distinguish between elements
that have the same name but come from different problem domain. An XM L
Schema supports namespaces.
Let us say for example we are taking about an attribute called Name. It will can
have different meanings depending on whether it is applied to a customer, or
flight carrier. If both entities (a customer and a flight carrier) need to define the
same document such as in a flight entry, which associates a flight with its
corresponding information, and the list passengers on that flight. We need some
mechanism to distinguish between the two, and apply the correct semantic
description for the attribute name, whenever it is used in the document.
Namespaces provide the mechanism that allows us to write XML documents that
contain information relevant to the problem domain.
To include your namespace information into your XML file when creating your
XML document, select the option Create XML file from an XML Schema file,
which specifies the namespace information. When you do that, the target
namespace and prefix from the XML Schema file is automatically picked up when
creating the document.