XPath/XQuery Functions: Image-Related

www.altova.com Expand/Collapse All Print this Topic Previous Page Up One Level Next page

Home >  Appendices > XSLT and XPath/XQuery Functions > Altova Extension Functions >

XPath/XQuery Functions: Image-Related

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.

 

Note about naming of functions and language applicability

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, http://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):

XP1 XP2 XP3.1

XSLT functions (used in XPath expressions in XSLT):

Xslt1 XSLT2 XSLT3

XQuery functions (used in XQuery expressions in XQuery):

XQ1 XQ3.1

 

 

Click to expand/collapsesuggested-image-file-extension [altova:]

altova:suggested-image-file-extension(Base64String as string) as string?     XP3.1 XQ3.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.

altova:suggested-image-file-extension(/MyImages/MobilePhone/Image20141130.01) returns 'jpg'
altova:suggested-image-file-extension($XML1/Staff/Person/@photo) returns ''

 

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.

 

 

Click to expand/collapseimage-exif-data [altova:]

altova:image-exif-data(Base64BinaryString as string) as element?     XP3.1 XQ3.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 in image-exif-data(//MyImages/Image20141130.01)/@* return name($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).

 

GPSLatitude

GPSLatitudeRef

GPSLongitude

GPSLongitudeRef

Geolocation

33 51 21.91

S

151 13 11.73

E

33°51'21.91"S 151°13'11.73"E

 

 

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).

Click to expand/collapse

 

ImageWidth
ImageLength
BitsPerSample
Compression
PhotometricInterpretation
Orientation
SamplesPerPixel
PlanarConfiguration
YCbCrSubSampling
YCbCrPositioning
XResolution
YResolution
ResolutionUnit
StripOffsets
RowsPerStrip
StripByteCounts
JPEGInterchangeFormat
JPEGInterchangeFormatLength
TransferFunction
WhitePoint
PrimaryChromaticities
YCbCrCoefficients
ReferenceBlackWhite
DateTime
ImageDescription
Make
Model
Software
Artist
Copyright

------------------------------

 

ExifVersion
FlashpixVersion
ColorSpace
ComponentsConfiguration
CompressedBitsPerPixel
PixelXDimension
PixelYDimension
MakerNote
UserComment
RelatedSoundFile
DateTimeOriginal
DateTimeDigitized
SubSecTime
SubSecTimeOriginal
SubSecTimeDigitized
ExposureTime
FNumber
ExposureProgram
SpectralSensitivity
ISOSpeedRatings
OECF
ShutterSpeedValue
ApertureValue
BrightnessValue
ExposureBiasValue
MaxApertureValue
SubjectDistance
MeteringMode
LightSource
Flash
FocalLength
SubjectArea
FlashEnergy
SpatialFrequencyResponse
FocalPlaneXResolution
FocalPlaneYResolution
FocalPlaneResolutionUnit
SubjectLocation
ExposureIndex
SensingMethod
FileSource
SceneType
CFAPattern
CustomRendered
ExposureMode
WhiteBalance
DigitalZoomRatio
FocalLengthIn35mmFilm
SceneCaptureType
GainControl
Contrast
Saturation
Sharpness
DeviceSettingDescription
SubjectDistanceRange
ImageUniqueID

------------------------------

 

GPSVersionID
GPSLatitudeRef
GPSLatitude
GPSLongitudeRef
GPSLongitude
GPSAltitudeRef
GPSAltitude
GPSTimeStamp
GPSSatellites
GPSStatus
GPSMeasureMode
GPSDOP
GPSSpeedRef
GPSSpeed
GPSTrackRef
GPSTrack
GPSImgDirectionRef
GPSImgDirection
GPSMapDatum
GPSDestLatitudeRef
GPSDestLatitude
GPSDestLongitudeRef
GPSDestLongitude
GPSDestBearingRef
GPSDestBearing
GPSDestDistanceRef
GPSDestDistance
GPSProcessingMethod
GPSAreaInformation
GPSDateStamp
GPSDifferential

 

 

[ Top ]

 


© 2019 Altova GmbH