Re: Ax2 file handling

2007-05-24 Thread Matt Sergeant

On 23-May-07, at 7:57 AM, Lars Skjærlund wrote:


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


Ah I see...

Yeah, so one of the decisions I made for Ax2 was that all this stuff  
in AxKit1 was too horribly fragile and broke too much, so I just  
didn't implement it.


You have to do it directly with XML::LibXML handlers:

  XML::LibXML-callbacks( \match_uri, \open_uri, \read_uri,  
\close_uri);


Then implement your match/open/read/close as AxKit1 did.

I'd like to clean this up so that it's more provider-like as in  
AxKit1... But I'm just not sure exactly how yet. Perhaps via Moe's  
message-passing stuff he added in.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Ax2 file handling

2007-05-24 Thread Jörg Walter
On Dunnersdag, 24. Mai 2007, Matt Sergeant wrote:

 I'd like to clean this up so that it's more provider-like as in
 AxKit1... But I'm just not sure exactly how yet. Perhaps via Moe's
 message-passing stuff he added in.

Huh? Did I hear my name? :-)

Message passing would work, but wouldn't a separate (nested?) run of 
hook_xmlresponse more closely match the semantics of such a lookup? Maybe 
even a subrequest-like building of a new client object?

Thinking about it, it might really be a good idea to define some standard 
message for document retrieval, plus a subrequest API which can be used from 
such a message handler if that much overhead is desired. That way, access 
could also effectively be restricted to allowed/defined content, since no 
generic lookup is done by default.

Multiple message handlers could coexist, since a return value of DECLINED 
works as expected, and an .odt plugin could handle requests like

$client-send('get_xml','odt:Pictures/logo.jpg')

automatically rooted at the current file, and other plugins could handle other 
pseudo-URLs, without conflict or the need for a central registry or anything.



-- 
CU
Joerg

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Ax2 file handling

2007-05-23 Thread Matt Sergeant

[EMAIL PROTECTED] 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Ax2 file handling

2007-05-23 Thread Lars Skjærlund
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-content/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.dk/lars


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]