Working with Namespaces

When the XML document declares one or more namespaces, those namespaces are displayed in the namespace pane, as shown here:

In addition to the namespace URI, Stylus Studio displays the namespace prefix declared in the XML document, if any, and a prefix that is used when creating XPath query expressions.

If one namespace prefix clashes with another in the XML document, Stylus Studio renames the second prefix by adding a number to the end of the original prefix name to make it unique - for example, if two namespaces have the prefix bks, the second is renamed bks1. Similarly, if no namespace prefix has been declared, Stylus Studio creates a default namespace prefix, ns1. Namespace declarations in the XML document are not changed.

Namespace prefixes defined for the query

l Allow you to execute the query with the root node of the document as the current context node
l Simplify the process of entering XPath expressions in the query pane

Changes saved to the XML document are reflected in the namespace pane when you click on the namespace pane or query pane.

Viewing/Changing Namespace Prefixes

You must use the value in the Query for Prefix field when writing XPath query expressions; you can specify your own prefix if want to use one other than the one provided by Stylus Studio.

To change a namespace prefix:
1. Click the Show Namespaces button ( ) if the namespace pane is not already displayed.
The namespace pane shows any namespaces that have been defined for the current XML document, as well their associated namespace prefixes, if any.
2. Optionally, change the value in the Prefix for Query field.
 
Free Stylus Studio XML Training: