XQuery/Unzipping an Office Open XML docx file

Motivation
You want to uncompress an docx file

Method
We will use the compression:unzip function used in the prior example and pass it a local version of the function that handles the uncompression.

File Names
Some file names in docx files such as '[Content_Types].xml' are not valid URIs. So these must be renamed to files with valid URIs.

Here is a typical list of the path names in a docx file:

Note that there are three subfolders created (_rels, word and docProps). The XML files are stored in these files.

unzip-docx function
The following function is used to unzip a docx file. This function name must be passed as a parameter to the unzip function to tell it to do with each docx file.

Note that you must pass in parameters to this function from the calling function.

unzip-docx function: