When transforming some xml with referenced graphics I want to add a scale attribute to “big” graphics. However the graphics do not have any size information. Is it possible with xslt to “read” the graphic size in some way?
This:
<image href="sample.gif"/>
should become this
<image href="sample.gif" scale="50"/>
if the sample.gif graphic is bigger (width or height) than “x“. To be able to do so I need to “read” the size of the graphic (as there are no attributes with/height values, assuming that all graphics are actually present and accessible (in the file system).
Is there any possibility to do this?
I don’t think that this is possible with pure XSLT (without using an extension function).
XSLT 2.0 and above have the
unparsed-text()function, which allows any text file to be read, but I don’t think this allows any binary code (as 0x00) to be read — the file must be a text file.