Re: [xslt] XSLT and Safari
- From: Dave Hyatt <hyatt apple com>
- To: veillard redhat com
- Cc: The Gnome XSLT library mailing-list <xslt gnome org>
- Subject: Re: [xslt] XSLT and Safari
- Date: Mon, 16 Aug 2004 16:06:39 -0700
What is the dict used for? I'm going to have parsed these documents
(and have xmlDocPtrs ready) before stylesheet compilation time. Is
that going to be an issue?
dave
On Aug 16, 2004, at 4:02 PM, Daniel Veillard wrote:
On Tue, Aug 10, 2004 at 03:57:21PM -0700, David Hyatt wrote:
I can figure out all the imports/includes, use our own security
routines and recursion defenses when loading, and ultimately end up
with a bunch of xmlDocPtrs. What I'd then like to do is be able to
tell libxslt to parse a top-level stylesheet, but then register
callbacks, so that for a given import/include URI in a specified
parent
stylesheet, I could then hand back the xmlDocPtr without libxslt
having
to do any I/O. I'm not trying to reuse these xmlDocPtrs, so libxslt
would be free to modify them if it needed to.
Okay, I just commited the following API to CVS in
libxslt/documents.h:
----------------------------------
/*
* Hooks for document loading
*/
/**
* xsltLoadType:
*
* Enum defining the kind of loader requirement.
*/
typedef enum {
XSLT_LOAD_START = 0, /* loading for a top stylesheet */
XSLT_LOAD_STYLESHEET = 1, /* loading for a stylesheet
include/import */
XSLT_LOAD_DOCUMENT = 2 /* loading document at transformation
time */
} xsltLoadType;
/**
* xsltDocLoaderFunc:
* @URI: the URI of the document to load
* @dict: the dictionnary to use when parsing that document
* @options: parsing options, a set of xmlParserOption
* @ctxt: the context, either a stylesheet or a transformation context
* @type: the xsltLoadType indicating the kind of loading required
*
* An xsltDocLoaderFunc is a signature for a function which can be
* registered to load document not provided by the compilation or
* transformation API themselve, for example when an xsl:import,
* xsl:include is found at compilation time or when a document()
* call is made at runtime.
*
* Returns the pointer to the document (which will be modified and
* freed by the engine later), or NULL in case of error.
*/
typedef xmlDocPtr (*xsltDocLoaderFunc) (const xmlChar *URI,
xmlDictPtr dict,
int options,
void *ctxt,
xsltLoadType type);
XSLTPUBFUN void XSLTCALL
xsltSetLoaderFunc (xsltDocLoaderFunc f);
/* the loader may be needed by extension libraries so it is exported */
XSLTPUBVAR xsltDocLoaderFunc xsltDocDefaultLoader;
----------------------------------
This seems to work as I converted libxslt to use those functions
internally, regression tests passes, and the only part not used is
the 4 lines xsltSetLoaderFunc() function.
Please try it soon and give feedback, I would like to make a new
release
within a weeks and if there is a problem let's fix it before,
Daniel
--
Daniel Veillard | Red Hat Desktop team http://redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit
http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]