Returns a predefined namespace URI by the specified namespace prefix.
This function allows you to avoid specifying XML namespace URIs directly in templates. Instead, you can first declare in the XML Type Configuration File (where the current XML data sources is described) a binding between the namespace URI and a certain prefix. Then, you can use this function and prefix to obtain the namespace URI.
Parameters:
prefix
The prefix representing the required namespace URI.Returns:The binding between the prefix and the namespace URI must be declared in the configuration of the XML Type, on which the given template is based.
If no namespace prefix found that is associated with this XML Type, the function rises an error.
The namespace URI bound to the specified prefix.
Example:
Let's suppose we want to print the qualified name of the XSD 'anyType'
type,
however with the namespace prefix assumed for the XSD namespace in the context of the
given XML file (being processed by this template).
For instance, such a qualified name may look like 'xs:anyType'
or 'xsd:anyType'
or even without prefix at all.
Here is how we can do that.
First, in the XML Types Configuration File, where we define the 'myxml'
XML Type describing XML files processes by the template, we declare the binding:
Now, to produce the necessary qualified name in template, we can use the following expression:myxml.ns.1.prefix = xs myxml.ns.1.uri = http://www.w3.org/2001/XMLSchema
QName(getNamespaceURI("xs"), "anyType").toString()
See Also:
belongsToNS()
${include ../../../refs/xml_names.htm}