"Re: [xslt] Apply stylesheet to a subbranch of a document"



Hi,

Daniel Veillard wrote:
> On Tue, Sep 16, 2003 at 03:57:33PM +0200, Kasimier Buchcik wrote:
> 
>>I took a quick look inside xsltApplyStylesheetInternal()...
>>The given doc is set as the initial context node of the transformation:
>>
>>ctxt->node = (xmlNodePtr) doc;
>>
>>Would the transformation still work correctly if we specify a node other 
>>than the document as the initial context node?
> 
> 
>   Well correctly can't be asserted because XSLT-1.0 is not defined
> for a subdocument.
> 
> 
>>Could there be a public function like:
>>
>>xsltApplyStylesheet(xsltStylesheetPtr style, 
>>
>>   xmlDocPtr doc,
>>   xmlNodePtr ctxNode,
>>   const char **params);
>>
>>with ctxNode specifying the initial context node?
> 
> 
>   That could be done, but I'm afraid it's misleading, for the reason
> I state: the document is modified, so the subtree would be modified.
> I'm not sure it's a good idea to then go on processing with a half 
> modified tree.
>   I think most entry point called by xsltApplyStylesheetInternal
> are public, write the modified function and try it this might work.

If I would test it and everything would be fine, could I persuade you to 
put it into libxslt, since we don't intend to start a proprietary 
branch. If you are absolutely unwilling to expand the functionality in 
this way, there's no reason for me to even try it.
By the way, 2 more questions:
- do you have any idea how to avoid the _private field during 
transformation in the future (if this is intended at all for the future)?
- if the modified function won't work, is the functionality of 
transforming subtrees somewhere in the pipe, or do I need to wait for 
libxslt2?

Thanks,

Kasimier Buchcik




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]