Re: [xslt] str:tokenize behavior



On Wed, Apr 23, 2003 at 10:36:07PM -0600, Vakoc, Mark wrote:
> >  Yup, looks like the problem. Plus the tokenize function returns
> > an XPATH_NODESET intead of a XPATH_XSLT_TREE making the detection 
> >nearly impossible ... In a nutshell seems:
> >    - the tokenize function need to return a XPATH_XSLT_TREE (easy)
> >    - xsltForEach need to detect the case of and XPATH_XSLT_TREE 
> >      and iterate on the children instead of the document node.
> 
> Hmmm...  This could be a little tough.  If the function returns
> XPATH_XSLT_TREE and xsltForEach treats this as a node set then that would
> allow essentially allow xsltForEach to work against any RTF, which isn't
> correct, such as below
> 
> <xsl:variable name="var"><node/><node/><node/></xsl:variable>
> 
> <xsl:for-each select="$var">.....</xsl:for-each>
> 
> Somehow we need to know that the RTF returned by extension functions such as
> str:tokenize isn't a RTF like the one created above.  That is why I had it
> return the XPATH_NODESET object type.

  Hum, there is 2 options:
    - either this must behave like a node set, an in this case the
      nodeset should contain the list of nodes not, the parent document
      element
    - or check in xsltForEach for the boolean bit of the XPATH_NODESET
      nodeset object, and if there is only one node, it's a doc with
      the "fake" name then process at the children level.
Seems to me the first option is the most coherent.

> Might the solution be to internally create a new xpath object type, say
> XPATH_XSLT_NODESET for extension functions that return RTF node-sets?  This
> way libxslt can know when iterating across the nodes using xsl:for-each and
> xsl:apply-templates against a extension function's return RTF is legal and
> not perform an automatic node-set() conversion against actual RTFs.

  Well adding one more type would make the code even more complex.

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/



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