Search code examples
orbeonxforms

Orbeon xforms and downloading a file


If i have a file instance in Orbeon-xform

<xforms:instance id="fileinst">
    <fileinst>
        <file>
            <name>file.txt</name>
            <type>text/plain</type>
            <data>YXNkZmFzZmFzZGY=</data><!--the file content-->
        </file>
    </fileinst>
</xforms:instance>

and also corresponding binds

<xforms:bind nodeset="instance('fileinst')/file">
    <xforms:bind nodeset="fail">
        <xforms:bind nodeset="name" type="xforms:string"/>
        <xforms:bind nodeset="type" type="xforms:string"/>
        <xforms:bind nodeset="data" type="xforms:base64Binary"/>
    </xforms:bind>
</xforms:bind>

How to do a downlowdable file from this:

<xforms:outpu ref="instance('fileinst')/file/data">
    <xforms:label>Download</xforms:label>
</xforms:outpu>

How to do correctly a downlable file link?


Solution

  • maybe something like:

    <xforms:output ref="instance('fileinst')/file/data" appearance="xxforms:download">
      <xforms:filename ref="instance('fileinst')/file/@name" />
      <xforms:mediatype ref="instance('fileinst')/file/@type" />
      <xforms:label>Download</xforms:label>
    </xforms:output>
    

    NB! xxforms:download