The following image-related XPath/XQuery extension functions are supported in the current version of XMLSpy and can be used in (i) XPath expressions in an XSLT context, or (ii) XQuery expressions in an XQuery document.
Altova extension functions can be used in XPath/XQuery expressions. They provide additional functionality to the functionality that is available in the standard library of XPath, XQuery, and XSLT functions. Altova extension functions are in the Altova extension functions namespace, https://www.altova.com/xslt-extensions, and are indicated in this section with the prefix altova:, which is assumed to be bound to this namespace. Note that, in future versions of your product, support for a function might be discontinued or the behavior of individual functions might change. Consult the documentation of future releases for information about support for Altova extension functions in that release.
XPath functions (used in XPath expressions in XSLT):
XSLT functions (used in XPath expressions in XSLT):
XQuery functions (used in XQuery expressions in XQuery):
altova:suggested-image-file-extension(Base64String as string) as string?XP3.1XQ3.1
Takes the Base64 encoding of an image file as its argument and returns the file extension of the image as recorded in the Base64-encoding of the image. The returned value is a suggestion based on the image type information available in the encoding. If this information is not available, then an empty string is returned. This function is useful if you wish to save a Base64 image as a file and wish to dynamically retrieve an appropriate file extension.
In the examples above, the nodes supplied as the argument of the function are assumed to contain a Base64-encoded image. The first example retrieves jpg as the file's type and extension. In the second example, the submitted Base64 encoding does not provide usable file extension information.
altova:image-exif-data(Base64BinaryString as string) as element?XP3.1XQ3.1
Takes a Base64-encoded JPEG image as its argument and returns an element called Exif that contains the Exif metadata of the image. The Exif metadata is created as attribute-value pairs of the Exif element. The attribute names are the Exif data tags found in the Base64 encoding. The list of Exif-specification tags is given below. If a vendor-specific tag is present in the Exif data, this tag and its value will also be returned as an attribute-value pair. Additional to the standard Exif metadata tags (see list below), Altova-specific attribute-value pairs are also generated. These Altova Exif attributes are listed below.
•To access any one attribute, use the function like this: image-exif-data(//MyImages/Image20141130.01)/@GPSLatitude image-exif-data(//MyImages/Image20141130.01)/@Geolocation
•To access all the attributes, use the function like this: image-exif-data(//MyImages/Image20141130.01)/@*
•To access the names of all the attributes, use the following expression: for\$i inimage-exif-data(//MyImages/Image20141130.01)/@* returnname(\$i) This is useful to find out the names of the attributes returned by the function.
The Altova XPath/XQuery Engine generates the custom attribute Geolocation from standard Exif metadata tags. Geolocation is a concatenation of four Exif tags: GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, with units added (see table below).
The Altova XPath/XQuery Engine generates the custom attribute OrientationDegree from the Exif metadata tag Orientation.
OrientationDegree translates the standard Exif tag Orientation from an integer value (1, 8, 3, or 6) to the respective degree values of each (0, 90, 180, 270), as shown in the figure below. Note that there are no translations of the Orientation values of 2, 4, 5, 7. (These orientations are obtained by flipping image 1 across its vertical center axis to get the image with a value of 2, and then rotating this image in 90-degree jumps clockwise to get the values of 7, 4, and 5, respectively).