[4suite-dev] [4suite] XSLT Processor Bug: importIndex not properly updated on 'appendStylesheetXXX'
Sidney
csidney79 at gmail.com
Mon Oct 1 08:28:38 MDT 2007
Hi Uche,
I don't think the bug I reported is the same, but they could be related.
The bug I reported surfaces when you use one of the 'appendStylesheet' type
functions of the Ft.Xml.Xslt.Processor, where as the bug you mentioned is a
compilation bug that appears from the use of xsl:include and xsl:import in a
stylesheet.
The method Processor.__add_stylesheet gets called by all the
'appendStylesheetXXX' methods, but it currently only updates first level
children nodes (such as 'xsl:template'). Thus when an instruction calls
'xsl:appy-imports' or 'ft:apply-imports', it gets nothing.
If you can recall, 'xsl:apply-imports' and 'ft:apply-imports' make this
call:
context.stylesheet.applyTemplates(
context, processor,
maxImport=self.importIndex
)
where self.importIndex is the current instruction's import index
(see Ft/Xml/Xslt/ApplyImportsElement.py)
The current instruction's "importIndex" will always be lower than any of the
'xsl:template' element's import index if a 'appendStylsheetXXX' method has
been called on the processor.
One possible fix is to make the method Processor.__add_stylesheet
recursively update all children elements. I've been using this fix without
any problems for awhile now.
Another possible fix is to set the parameter 'maxImport' to the import index
of the current 'xsl:template' element. But I'm not sure if there is such a
reference available.
I also checked the CVS for XML1_0-maint branch to see if there was a related
fix in Ft/Xml/Xslt/Processor.py, but I could not find any.
-----Original Message-----
From: 4suite-dev-bounces at lists.fourthought.com
[mailto:4suite-dev-bounces at lists.fourthought.com] On Behalf Of Uche Ogbuji
Sent: Monday, October 01, 2007 8:00 AM
To: Sidney
Cc: 4suite-dev at 4suite.org; 4suite at lists.fourthought.com
Subject: Re: [4suite-dev] [4suite] XSLT Processor Bug: importIndex
notproperly updated on 'appendStylesheetXXX'
Sidney wrote:
> I believe this is a bug and wanted to confirm with the list.
>
> I've been having problems with 'xsl:apply-imports' and 'ft:apply-imports'.
> This occurs when a stylesheet is manually appended to a XSLT processor
using
> the 'appendStysheetXXX' methods prior to its execution.
>
> Upon further investigation, I believe the problem lies in the
> '__add_stylesheet' method of the XSLT 'class Processor'. This is method
> needs to recursively update the 'importIndex' on all children nodes and
> their descendents.
>
> So, it's straight forward fix and a capable developer should be able to
make
> the necessary change and update.
>
> Let me know if it is not so easy.
>
I forgot to mention I fixed
https://sourceforge.net/tracker/index.php?func=detail&aid=1786513&group_id=3
9954&atid=428292
Which sounds a lot like this bug. Can you confirm?
--
Uche Ogbuji http://uche.ogbuji.net
Founding Partner, Zepheira http://zepheira.com
Linked-in profile: http://www.linkedin.com/in/ucheogbuji
Articles: http://uche.ogbuji.net/tech/publications/
_______________________________________________
4suite-dev mailing list
4suite-dev at lists.fourthought.com
http://lists.fourthought.com/mailman/listinfo/4suite-dev
More information about the 4suite-dev
mailing list