[4suite] xslt problem with empty comment

Uche Ogbuji uche at ogbuji.net
Sat Dec 9 00:10:34 MST 2006


Jeremy Kloth wrote:
> On Friday 08 December 2006 9:53 am, Robert Forkel wrote:
>> File "/usr/lib/python2.4/site-packages/Ft/Xml/Xslt/TemplateElement.py",
>> line 83, in instantiate
>>     child.instantiate(context, processor)
>>   File "/usr/lib/python2.4/site-packages/Ft/Xml/Xslt/CommentElement.py",
>> line 39, in instantiate
>>     if content[-1] == u'-':
>> IndexError: string index out of range
> 
> Thanks for the report.  It is now fixed in CVS. The following patch fixes the 
> problem.
> 
> Index: CommentElement.py
> ===================================================================
> RCS file: /var/local/cvsroot/4Suite/Ft/Xml/Xslt/CommentElement.py,v
> retrieving revision 1.9
> retrieving revision 1.10
> diff -U2 -r1.9 -r1.10
> --- CommentElement.py   24 Jun 2006 05:13:01 -0000      1.9
> +++ CommentElement.py   8 Dec 2006 18:14:38 -0000       1.10
> @@ -37,5 +37,5 @@
>          # but we are allowed to add a space. (XSLT 1.0 sec. 7.4)
>          content = content.replace(u'--', u'- -')
> -        if content[-1] == u'-':
> +        if content[-1:] == u'-':
>              content += u' '

Did/could you add a regression test case as well?


-- 
Uche Ogbuji                               Work: The Kadomo Group, Inc.
http://uche.ogbuji.net                    http://kadomo.com
http://copia.ogbuji.net                   Lead dev at http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/


More information about the 4suite mailing list