Re: [xslt] <sort/> dumps core



On Thu, Apr 26, 2001 at 02:05:19PM -0400, Daniel Veillard wrote:
> On Thu, Apr 26, 2001 at 01:04:08PM -0400, Liam Quin wrote:
> > libbxslt-0.7.0-1
> > libxml-1.8.11-1mdk
> > 
> > I find that if I use <sort/> inside a for-each, with no attributes,
> > I get a core dump.  Is this known, or should I investigate more?
> 
>   Well it's part of the 2-3 libxslt pending bug report i got before
> 0.8.0 was released and that I still didn't analized,

 the enclosed patch relative to 0.8.0 should fix the problem:

orchis:~/XSLT/tests/general -> cat bug-15-.xsl
<?xml version = "1.0" encoding = "UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:template match='doc'>
<html>
<body>
<ul>
    <xsl:for-each select='items'>
    <xsl:sort/>
    <li><xsl:value-of select='.'/></li>
    </xsl:for-each>
</ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
orchis:~/XSLT/tests/general -> cat ../docs/bug-15-.xml
<doc>
    <items>b</items>
    <items>a</items>
    <items>c</items>
</doc>
orchis:~/XSLT/tests/general -> xsltproc bug-15-.xsl ../docs/bug-15-.xml
<?xml version="1.0"?>
<html><body><ul><li>a</li><li>b</li><li>c</li></ul></body></html>
orchis:~/XSLT/tests/general -> 

   thanks for the report,

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
Index: preproc.c
===================================================================
RCS file: /cvs/gnome/libxslt/libxslt/preproc.c,v
retrieving revision 1.10
diff -c -r1.10 preproc.c
*** preproc.c	2001/04/22 20:31:15	1.10
--- preproc.c	2001/04/27 08:26:08
***************
*** 324,334 ****
  
      comp->select = xmlGetNsProp(inst,(const xmlChar *)"select", XSLT_NAMESPACE);
      if (comp->select == NULL) {
! 	comp->select = xmlNodeGetContent(inst);
! 	if (comp->select == NULL) {
! 	    xsltGenericError(xsltGenericErrorContext,
! 		 "xsltSortComp: select is not defined\n");
! 	}
      }
  }
  
--- 324,335 ----
  
      comp->select = xmlGetNsProp(inst,(const xmlChar *)"select", XSLT_NAMESPACE);
      if (comp->select == NULL) {
! 	/*
! 	 * The default value of the select attribute is ., which will
! 	 * cause the string-value of the current node to be used as
! 	 * the sort key.
! 	 */
! 	comp->select = xmlStrdup((const xmlChar *)".");
      }
  }
  


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