XSLT and XPath function reference in alphabetical order
(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)
Association and localisation of nodes and resources at runtime
A xs:string string; the public identifier of the unparsed entity whose identifier is passed on to the function.
Obligatory. A xs:string string; the identifier of an entity not to be processed by the XML parser. If no appropriate ENTITY declaration exists, the function returns an empty string.
Purpose of use:
The function returns the PUBLIC identifier of that unparsed entity whose entity name had been passed on to it, provided that such a PUBLIC identifier exists. The function always refers to the document which contains the context node being valid at the moment of the function call.
It is an error if the function is called up in case the context item is not a node or the tree in which the context node lies has no document node (ERR XTDE1380).
If the entity passed on has no PUBLIC identifier, the function returns the empty string. The same happens if no entity of the identifier passed on exists or if an accordingly named entity is declared, but it is not an external, unparsed entity (but, for example, an external text entity). Therefore, by means of the return value, these three cases cannot be distinguished.
A PUBLIC identifier can optionally be assigned in addtion to the obligatory SYSTEM identifier (which contains the path and the file name of the entity) in the scope of the ENTITY declaration. The declaration of both identifiers is introduced by the keyword PUBLIC whereby the obligatory SYSTEM identifier string follows the PUBLIC identifier string:
<!ENTITY myEntity PUBLIC "My Public Identifier" "/my_path/my_file.ent" NDATA my_application>
Without PUBLIC identifier, the declaration of the same entity is as follows (the keyword SYSTEM is now used instead of PUBLIC):
<!ENTITY myEntity SYSTEM "/my_path/my_file.ent" NDATA my_application>
The pursose of a PUBLIC identifier is to give an application the possibility to find a resource as an alternative to the path also passed on by means of an identifier which is compared to a catalogue of local entity files. In case of an unparsed entity, the access to a local copy might sped up the processing.
PUBLIC identifier of external (parsed) text entities
Also external text entities may have a PUBLIC identifier. However, it would not make sense to apply it in the XSLT context on a comparable function since the XML parser already parses and embeds the external text resource when reading in the XML document. For an unparsed entity, its reference is only passed through by the XML parser.
The function is not available.
unparsed-entity-public-id($entity-name as xs:string) as xs:string
|<< back||next >>|
Copyright © Galileo Press, Bonn 2008
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSLT 2.0 & XPath 2.0" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn, Germany