W3C home > Mailing lists > Public > xproc-dev@w3.org > June 2010

cx:unzip with content-type="image/png"

From: Manfred Staudinger <manfred.staudinger@gmail.com>
Date: Sun, 20 Jun 2010 22:52:09 +0200
Message-ID: <AANLkTikEFmLBy9ZXcawXRa_U8wypgs26-H57AeqqXiP9@mail.gmail.com>
To: xproc-dev <xproc-dev@w3.org>
I'm using Calabash 0.9.21. When I use cx:unzip to extract thumbnail
pictures with a content-type of "image/png" from a dwfx file (autocad)
   <p:iteration-source select="//dwf:Resource[@role='thumbnail']"/>
   <p:variable name="nextdoc" select="substring(*/@href, 2)"/>
   <p:variable name="img" select="concat('/img_',
p:iteration-position(), '.png')"/>
   <cx:unzip content-type="image/png">
      <p:with-option name="href" select="$package"/>
      <p:with-option name="file" select="$nextdoc"/>
   <p:store cx:decode="true">
      <p:with-option name="href" select="concat($path, $img)"/>

The cx:unzip works according to its spec:
   If the content-type specified is not an XML content type, the file is base64
   encoded and returned in a single c:data element. [1]
Note 1: the c:data wrapper does _not_ contain an encoding attribute
nor is the need for it explicitly mentioned in the spec. But the XProc
specification clearly states:
   If the content was base64-encoded, the wrapper must have an encoding
   attribute which specifies “base64”. [2]
Note 2: The p:store with cx:decode="true" does not store the binary,
but the unchanged output from the cx:unzip. But when I insert an
   <p:add-attribute match="c:data" attribute-name="encoding"
just before the p:store then the input is decoded as expected. The
only documentation I found for the cx:decode extension attribute
   If cx:decode=true and the input document is base64 encoded, decode it and
   store the binary result. [3]
does not show its dependence on the encoding attribute.

Any thoughts and pointers to documentation are appreciated.


[1] http://exproc.org/proposed/steps/other.html
[2] http://www.w3.org/TR/xproc/#p.data
[3] http://lists.w3.org/Archives/Public/xproc-dev/2009Oct/0006.html
Received on Sunday, 20 June 2010 20:52:38 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:16:53 UTC