- From: Alex Muir <alex.g.muir@gmail.com>
- Date: Wed, 21 Apr 2010 17:27:04 +0000
- To: Dave Pawson <dave.pawson@gmail.com>
- Cc: Toman_Vojtech@emc.com, xproc-dev@w3.org
- Message-ID: <h2o88b533b91004211027q36d9af2n66e7aefe08686ee8@mail.gmail.com>
I should be more specific, I was able to unzip an xml file and work with
that however I was not able to unzip an HTML file ( non xml content) and get
that content into an XSLT stylesheet in a following step to do further
processing without using tidy or tag soup. This must be possible but don't
know how to get it done.
I wrote some code here to test the zip but just left it as an example
reading in XML.
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="
http://www.w3.org/ns/xproc-step"
xmlns:cx="http://xmlcalabash.com/ns/extensions" name="Zip test">
<p:input port="source">
<p:document href="blank.xml"/>
</p:input>
<p:output port="result" sequence="true"/>
<p:declare-step type="cx:message">
<p:input port="source"/>
<p:output port="result"/>
<p:option name="message" required="true"/>
</p:declare-step>
<p:declare-step type="cx:unzip">
<p:output port="result"/>
<p:option name="href" required="true"/>
<p:option name="file"/>
<p:option name="content-type"/>
</p:declare-step>
<p:variable name="source-folder" select="'zip/'"/>
<p:variable name="output-folder" select="'out/'"/>
<p:directory-list>
<p:with-option name="path" select="$source-folder">
<p:empty/>
</p:with-option>
</p:directory-list>
<p:for-each name="forEachFile">
<p:iteration-source select="//c:file[position() gt 0 ]"/>
<p:variable name="fileName" select="c:file/@name"/>
<cx:message>
<p:with-option name="message"
select="concat(p:iteration-size(),' ', p:iteration-position(), '
', $fileName)"/>
</cx:message>
<cx:unzip name="get-XML">
<p:with-option name="href" select="concat($source-folder,$fileName)"/>
<p:with-option name="file" select="replace($fileName,'.zip','.xml')"/>
</cx:unzip>
**** WOULD LIKE TO UNZIP HTML FILE AND PUT IT INTO A p:xslt ****
<p:wrap wrapper="document" match="*"> </p:wrap>
</p:for-each>
<p:documentation>Wrap result XML </p:documentation>
<p:wrap-sequence wrapper="forEachFile"/>
<p:identity/>
</p:declare-step>
On Wed, Apr 21, 2010 at 5:01 PM, Dave Pawson <dave.pawson@gmail.com> wrote:
> On 21 April 2010 16:12, Alex Muir <alex.g.muir@gmail.com> wrote:
> > Hi,
> >
> > I was having trouble with the unzip function as well.
>
>
> <p:declare-step type="cx:unzip" name="uz">
> <p:output port="result"/>
> <p:option name="href" required="true"/>
> <p:option name="file"/>
> <p:option name="content-type"/>
> </p:declare-step>
>
>
> <cx:unzip href='11620.epub' name='unravel' />
>
> Worked for me with Calabash.
>
> regards
>
>
>
> --
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.
> http://www.dpawson.co.uk
>
--
Alex
https://sites.google.com/a/utg.edu.gm/alex
Some Good Music
http://sites.google.com/site/greigconteh/
Received on Wednesday, 21 April 2010 17:27:38 UTC