Re: [xslt] Fwd: XML::LibXSLT bug, comments in xsl:text



On Wed, Dec 04, 2002 at 07:45:40AM +0000, Matt Sergeant wrote:
> This is probably a libxslt issue.
> 
> Begin forwarded message:
> 
> > From: Bjoern Hoehrmann <derhoermi@gmx.net>
> > Date: Wed Dec 4, 2002  03:23:18 Europe/London
> > To: matt@sergeant.org
> > Cc: www-archive@w3.org
> > Subject: XML::LibXSLT bug, comments in xsl:text
> >
> > Hi Matt,
> >
> >   Using XML::LibXSLT I came across the following bug in XML::LibXSLT. 
> > On
> > the following construct,
> >
> >   <xsl:text><!--comment--> <!--comment--></xsl:text>
> >   ...
> >   <xsl:text><!--comment--> <!--comment--></xsl:text>
> >
> > I get
> >
> >   compilation error: file foo.xslt element text
> >   xsltParseTemplateContent: xslt:text content problem
> >   compilation error: file foo.xslt element text
> >   xsltParseTemplateContent: xslt:text content problem

  right it was a libxslt bug:

paphio:~/tmp -> cat tst.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>
<xsl:template match="/">
<doc>
<xsl:text><!--comment--> <!--comment--></xsl:text>
</doc>
</xsl:template>
</xsl:stylesheet>
paphio:~/tmp -> xsltproc tst.xsl tst.xsl
compilation error: file tst.xsl line 7 element text
xsltParseTemplateContent: xslt:text content problem
paphio:~/tmp ->

 fixed in CVS now:

paphio:~/tmp -> xsltproc tst.xsl tst.xsl
<?xml version="1.0"?>
<doc> </doc>
paphio:~/tmp ->

 patch enclosed, thanks !

> > on STDERR. Would be neat if it'd also report line/column on errors. The
> > bug -- disallowing comments in xsl:text elements -- is most likely
> > inherited from libxslt...

  That should be fixed if XML::LibXML or XML::LibXSLT activated line numbering
by adding the following:

    xmlLineNumbersDefault(1);

  in the module initialization.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
Index: libxslt/xslt.c
===================================================================
RCS file: /cvs/gnome/libxslt/libxslt/xslt.c,v
retrieving revision 1.83
diff -c -r1.83 xslt.c
*** libxslt/xslt.c	15 Oct 2002 16:06:47 -0000	1.83
--- libxslt/xslt.c	4 Dec 2002 17:11:42 -0000
***************
*** 1397,1402 ****
--- 1397,1406 ----
  		    }
  
  		    while (text != NULL) {
+ 			if (text->type == XML_COMMENT_NODE) {
+ 			    text = text->next;
+ 			    continue;
+ 			}
  			if ((text->type != XML_TEXT_NODE) &&
  			     (text->type != XML_CDATA_SECTION_NODE)) {
  			    xsltTransformError(NULL, style, cur,


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