Re: [xslt] Typo in transform.c??



On Wed, 22 Sep 2004 07:52:47 -0400, Daniel Veillard <veillard redhat com> wrote:
> On Wed, Sep 22, 2004 at 12:40:55PM +0100, Stuart Dootson wrote:
> > Hi - I'm using libxslt 1.1.10 in an application & setting my own error
> > handler via xsltSetGenericErrorFunc. I'm finding, however, that if
> > errors occur when I call xsltApplyStylesheetUser, the context is set
> > to NULL. This appears to be because calls to xsltGenericError in
> > transform.c are using xsltGenericDebugContext as the context parameter
> > rather than xsltGenericErrorContext (which is used everywhere else in
> > libxslt). Is this a bug?
> 
>   Sounds so, I just checked it, yes this looks buggy, I fixed it and
> will commit this later.
> 
> > On a related note - I provoked a compilation error during a call to
> > xsltParseStylesheetDoc by changing the <xsl:stylesheet> element to
> > <xsl:stalesheet> - I'm testing my error handling, as I'm not using a
> > fixed set of stylesheets. This caused a message to be generated with
> > the words 'compilation error' in. However, this was indicated as a
> > warning rather than an error in the returned stylesheet structure
> > (i.e. the warnings member was incremented rather than the error
> > member). Is this by design? If so, what mechanism is there for
> > detected compilation errors? Or should I treat the warning count as if
> > it were an error count?
> 
>   I would need to duplicate this to double check precisely.
> The fact that syntactic checking are not complete is a known bug
>   http://bugzilla.gnome.org/show_bug.cgi?id=153094
> 
> 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/
> 

A sample stylesheet is attached at the bottom. The process I followed was:

xmlDocPtr stylesheetDoc = xmlParseFile(filename);
xsltStylesheetPtr stylesheet = xsltParseStylesheetDoc(stylesheetDoc);

Two errors are raised during xsltParseStylesheetDoc:

  compilation error: file very-simple.xslt element stalesheet.
  xsltStylePreCompute: unknown xsl:stalesheet

Basically, xsltStylePreCompute is whinging about not knowing what a
'stalesheet' is. Now - the point is - if xsltStylePreCompute doesn't
recognise an XSLT element (i.e. one in the
'http://www.w3.org/1999/XSL/Transform' namespace), is that an error or
not?

---------- sample.xsl ----------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stalesheet version="1.0" 
                xmlns:swn="http://www.sample.com/SWAN";
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

   <xsl:output method="xml" indent="yes"/>

   <xsl:template match="/">
      <wib>
         <xsl:apply-templates select="//swn:ChangeHistory"/>
      </wib>
   </xsl:template>

   <xsl:template match="swn:ChangeHistory">
      <ChangeHistory author="{./swn:Author}" date="{./swn:Date}"
version="{./swn:Version}">
         <xsl:value-of select="swn:Comment/text()"/>
      </ChangeHistory>
   </xsl:template>

</xsl:stalesheet>


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