Get an merge image metadata

Dear XProc Dev,

i am new to XProc. I need advice if and how the following problem could 
be solved with XProc. Here especially with XProc 1 and the Calabash 1.2 
engine, since this is shipped with Oxygen.

Problem: I have DocBook Documents with images referenced from an uri as 
value of a imagedata/@fileref attribute. The imagedata Element may 
contain optional attributes for image Dimensions. For further 
processing, i need to know the Dimensions. So the task is: find 
imagedata elements without @width and @depth attributes and add these 
attributes. I wrote a simple XSLT Skript for this, which makes use of an 
extension function in Java to get the image intrinsic Dimension. All 
this is part of a larger project which converts from DocBook to ODF.

Now i'd like to port my Project from XSLT-Only to XProc1 with Calabash 
1.2. For some reasons which are specific to Oxygen i have Problems using 
my Java extension function. I wonder if there is a solution which uses 
only XProc and Calabash built-in Extensions. I found the 
xs:metadata-extractor extension (see 
https://xmlcalabash.com/docs/reference/cx-metadata-extractor.html) with 
this signature:

|<p:declare-step| |type||="||cx:metadata-extractor||"| 
|xmlns:cx||="||http://xmlcalabash.com/ns/extensions||"||>|
|<p:output| |port||="||result||"||/>|
|<p:option| |name||="||href||"||/>|||||||
|</p:declare-step>|

|I understand that this step expects an URI and will produce an 
||<c:metadata .../> XML Document.|

|So my Question to this List is, if and how the following would be 
possible:|

|1) XSLT Transformation Step which reads my DocBook Document, identifies 
imagedata Elements without Dimensions and writes out the @fileref 
attribute. The Result of this Step is a Sequence of URIs.|

|2) For each of this URIs call the cx:metadata-extractor Extension. The 
Result of this Step is a Sequence of XML Documents, one for every URI, 
each with <cx:metadata /> as root.|

|3) Wrap these Documents into a single one. The Result of this Step is 
one XML Document with some <cx:metadata /> Elements.|

|4) XSLT Transformation Step which merges this new Document with the 
DocBook Document. For every imagedata Element, get the Dimension from 
the Metadata Document and add the @width and @depth Attributes. The 
Result of this Step is a DocBook XML Document, where every imagedata 
Element has the necessary Dimension Attributes.|

|Since i have experience with XSLT, Steps 1 and 4 shoult be no problem. 
But how could i manage Steps 2 and 3?
|

||

|
|

Received on Wednesday, 25 November 2020 04:31:37 UTC