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



targetpath

Usage: targetpath(pathname)

Converts a pathname in the source tree file space into the file system's real pathname for its corresponding target (relative to the program's working directory.)

This function is useful if you want to create files in additional to the default target file. You will need to use non-standard extensions to do this (such as with the Saxon output element). Those extensions need a real filename to create. This function gives you a real directory or filename in the target tree to use.

Consider the scenario described in the previous section where the target tree is in /home/citizen/projects/output. The index.xml source file creates the target file /home/citizen/projects/output/index.html. The way to create an extra output file in /home/citizen/projects/output/more.html is:

<saxon:output file="{TBF:targetpath('.')/more.html}" method="xml">
  <html>
    ...
  </html>
</saxon:output>

The expression TBF:targetpath('.') will produce the pathname projects/output, since the transbuild program was run from the /home/citizen directory. So the value of the file attribute will be projects/output/more.html.

Things start getting very complicated when you move away from the model of one source file creates one target file!