Node:sourcepath, Next:, Previous:size, Up:XPath functions



sourcepath

Usage: sourcepath(pathname)

Converts a pathname in the source tree file space into the file system's real pathname (relative to the processor's working directory.) This function was created for use with the document XPath function, allowing you to open other files in the source tree.

Consider this scenario: the source tree is in /home/citizen/projects/web, and we are processing the file /home/citizen/projects/web/index.xml and want to load extra data from /home/citizen/projects/web/extra.xml. Simply running document("extra.xml") would not work because the program's current working directory is not web. The correct approach is document(TBF:sourcepath('extra.xml')). If we are running Transbuild from the directory /home/citizen, the value of TBF:sourcepath('extra.xml') will be projects/web/extra.xml, which is what the document function needs to open the file.