List Info

Thread: Re: Ax2 file handling




Re: Ax2 file handling
user name
2007-05-23 06:29:31
Lars,

> I had created an Ax1 module that could extract the
'content.xml' from
> an OpenDocument .odt file - which is really just a
zip-file wrapper
> around a collection of datafiles. It worked so well
that I could call
> the document() function in an XSLT stylesheet, passing
the name of an
> odt-file as the reference, and Ax1 would let my plugin
extract
> 'content.xml' and pass it on to the XSLT processor.

Have a look at hook_xmlresponse.
That's where I do most of my processing.
Call a method from there that opens the file and extracts
the xml. 
Quite how you would pass xml to an xslt tho is beyond me.
I can send a sample if you wish...

John


------------------------------------------------------------
---------
To unsubscribe, e-mail: axkit-users-unsubscribeaxkit.org
For additional commands, e-mail: axkit-users-helpaxkit.org


Re: Ax2 file handling
user name
2007-05-23 15:54:07
john1firstb2b.net wrote:
> Lars,
> 
>> I had created an Ax1 module that could extract the
'content.xml' from
>> an OpenDocument .odt file - which is really just a
zip-file wrapper
>> around a collection of datafiles. It worked so well
that I could call
>> the document() function in an XSLT stylesheet,
passing the name of an
>> odt-file as the reference, and Ax1 would let my
plugin extract
>> 'content.xml' and pass it on to the XSLT
processor.
> 
> Have a look at hook_xmlresponse.
> That's where I do most of my processing.
> Call a method from there that opens the file and
extracts the xml. 
> Quite how you would pass xml to an xslt tho is beyond
me.
> I can send a sample if you wish...

See the gallery (in plugins/demo) plugin for an example of
how to "set" 
the XML.

Matt.

------------------------------------------------------------
---------
To unsubscribe, e-mail: axkit-users-unsubscribeaxkit.org
For additional commands, e-mail: axkit-users-helpaxkit.org


Re: Ax2 file handling
user name
2007-05-23 06:57:14
Hi John,

> Have a look at hook_xmlresponse.
> That's where I do most of my processing.
> Call a method from there that opens the file and
extracts the xml. 
> Quite how you would pass xml to an xslt tho is beyond
me.

Oh, I can show you that - the above is exactly what I'm
doing
already... 

My plugin presently does the following:

If you ask for a simple ODT file like 'index.odt', it will
open it,
extract 'content.xml', and pass it on for further
processing. 'Further
processing' means calling the XSLT engine to transform the
document, and
the result is returned to the browser. This works.

If you ask for something like 'index.odt/Pictures/logo.jpg',
it will
open the ODT, extract the image, and pass it on to the
browser without
further processing. This works as well.

In both circumstances I have a caching system in place as
well -
meaning that the files are extracted only once - until the
ODT is
updated, of course.

But when I try to access an ODT from within an XSLT
stylesheet, it
breaks:

With Ax1, the above solution was implemented as several
modules. One of
these modules had the sole purpose of grapping an ODT file,
extracting
the requested content, and pass it on. When I asked for an
ODT from
within an XSLT stylesheet like

<xsl:apply-templates
select="document('/contact.odt')/office:document-conten
t/office:body/office:text/*"/>

the request from the XSLT engine for the document was passed
on to Ax1
which would again recognize the ODT file, pass it to my
plugin, and let
me extract 'content.xml'. Works like a charm.

However, when I try to do the same with Ax2, it seems like
the XSLT
engine is trying to fetch the ODT file directly from the
file system; at
least the debug messages complains that the file starts with
'PK'
instead of '<'. 'PK' is the signature that starts all
zip-files
(Remember PKZip?) which is a strong indication that the XSLT
engine is
receiving the file in uncompressed, hence unprocessed,
form.

How do I make the XSLT engine fetch it's files from Ax2 like
it did in
Ax1?

Regards,
Lars
-- 

Lars Skjærlund
Skovengen 111
2980 Kokkedal
Denmark
 
Tel.: +45 70 25 88 10
 
http://www.skjaerlund.d
k/lars


------------------------------------------------------------
---------
To unsubscribe, e-mail: axkit-users-unsubscribeaxkit.org
For additional commands, e-mail: axkit-users-helpaxkit.org


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )