Macro Language Reference > Macros > Application > tsbaseuri
  
tsbaseuri
Description
Allows you to specify a base URI for a stream in order to provide a strict method for resolving any relative paths provided to the LibXML parser.
Syntax
tsbaseuri stream:s base path:s
tsbaseuri
[no parameter]
Invoke the Define Stream Base URI dialog box.
stream
The name of the stream to which the base URI will be applied
base path
The base URI
Additional Information
The base area created via this macro can be accessed from anywhere in PTC ALD by using a new area of the form {Þstrm} where strm is the name of the stream from which to pick up the base path. The equivalent URI in LibXML is x3b2://type=strmbase;name=strm/.
It is also possible to set a global default across PTC ALD by putting the base path into the system variable OE_libxml_system_base, although this method is not recommended as it is not unique to each document.
When LibXML needs to resolve a relative path, it picks the first valid URI it finds by searching for the following criteria in order:
The base URI of a stream, i.e. set by tsbaseuri
The URI of a file if the stream is a link to a real file
The contents of the _libxml_system_base variable
The base URI of a document , i.e. {.}
Note that if 2) contains an encoding in the URI (e.g. {:xml-auto}), the encoding will be ignored when calculating the new filename and will need to be respecified in the new URI if it is still required.
If for some reason these rules do not result in a valid absolute URI, an error will be generated. However, as the final step resolves to the directory from which the document was opened, this is unlikely to happen.
The area { } (or x3b2://type=strmbase/) follows these rules when calculating the final URI to which it should resolve.
XML Base
Should the base URI need to change in the middle of the XML document, it is possible to override the standard path resolution steps using XML Base. To make use of this, specify the attribute xml:base="/path/" on the required element: any relative URIs specified on child elements will try and resolve to this path first before following the standard rules.
For more information, see Technote 0077a: LibXML parser