Re: [xslt] libxslt-1.0.1 is released



Le 26/07/01 04:03:04, Thomas Broyer a écrit :
> Le 25/07/01 18:58:10, Daniel Veillard a écrit :
> > > I was thinking about a conformant implementation replacing this
> > > "fake" node with an xmlDoc but there is a bug in xmlCopyNode (see
> > > http://bugzilla.gnome.org/show_bug.cgi?id=58056 )
> > 
> >   Will fix, use xmlCopyDoc in the meantime,
> 
> The problem is with xmlXPathObjectCopy (which calls xmlCopyNode)

Here are some tests I made:

I made some minor changes to gnome-xml/xpath.c and
libxslt/libxslt/variables.c:
 · changed from xmlFreeNodeList to xmlFreeDoc in xmlXPathFreeValueTree
 · changed from xmlCopyNode to xmlCopyDoc in xmlXPathObjectCopy
 · changed from xmlNewDocNode to xmlNewDoc in xsltEvalVariable and
   xsltEvalGlobalVariable

There was then a problem (at least) in xsltForEach, which calls
xsltFindDocument (which doesn't find the document, of course).
So I commented out the call to xsltFindDocument and replaced it with
ctxt->document = list->nodeTab[i]->doc->doc.
Then there was a problem in xsltApplyStylesheetInternals when it calls
xmlXPathFreeNodeSet(ctxt->nodeList), so I commented out this line.

My XSLT test file (see below) works almost well.
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:exslt="http://exslt.org/common">

<xsl:variable name="test">
<a><b><c><d/></c></b></a>
</xsl:variable>

<xsl:template match="/">
<xsl:for-each select="exslt:node-set($test)">
  <xsl:value-of select="name()"/>;
  <xsl:for-each select="node()">
    <xsl:value-of select="name()"/>;
  </xsl:for-each>
</xsl:for-each>
<xsl:value-of select="count(exslt:node-set($test))"/>;
<xsl:value-of select="count(exslt:node-set($test)/a)"/>;
<xsl:copy-of select="exslt:node-set($test)"/>

<!--
<xsl:for-each select="exslt:node-set($test)/a">
  <xsl:value-of select="name()"/>
</xsl:for-each>
<xsl:copy-of select="exslt:node-set($test)/a"/>
-->
</xsl:template>
</xsl:stylesheet>

Here's the result:
ptittom:~$ xsltproc test.xml test.xml
<?xml version="1.0"?>
;
  a;
  1;
1;

<a><b><c><d/></c></b></a>
ptittom:~$

The last, commented lines do not work and produce weird chars: there's a
problem with the XPath evaluation (most probably a problem while setting up
the XPath context)

Hope these little, simple tests will help...

Tom.




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