At this point of the tutorial, you'll need to know the XPath standard to understand what follows.
The following macro is used to display in an external image viewer, the image referenced in the
fileref attribute of explicitly or implicitly selected DocBook elements
The image viewer used by this macro is an external program called gimp. It is launched using command start.
<command name="startImageViewer"> <macro> <sequence> <get context="$implicitElement/@fileref" expression="uri-to-file-name(resolve-uri(.))" /> <command name="start" parameter='gimp "%_"' /> </sequence> </macro> </command>
The above macro shows how to use get at its best:
context attribute contains "
$implicitElement/@fileref" which means attribute
fileref of explicitly or implicitly selected element, because
implicitElement is a predefined variable mapped to explicitly or implicitly selected element (more info. about this in next section).
expression attribute contains "
." is the
fileref attribute node. resolve-uri() in and uri-to-file-name() in are two non-standard XPath functions which are used to resolve a relative URL and then to convert this URL to a file name (xv will not work if passed an URL).