Hi, Mansour.
Mansour <[EMAIL PROTECTED]> wrote on 2008-01-23 04:44:07 PM:
> Henry Zongaro wrote:
> > Mansour <[EMAIL PROTECTED]> wrote on 2008-01-21 10:40:13 PM:
> > > Ok, I need to implement the ESLT function for match. Somehting like
> > this:
> > >
> > > <xsl:for-each select="regexp:match('word')">
> > > <WORD>
> > > <xsl:value-of select="." />
> > > </WORD>
> > > </xsl:for-each>
> > >
> > > I have added the method match and am able to call it successfully.
But
> > > how do I retrieve the part inside the for-each?
> > >
> > > Is there a way to access the sheet elements from the
> > ExpressionContext ?
> > Your example uses an extension function. Would it be possible for you
> > to use an extension element instead? It would seem more natural to
> > want to get the element and its children in that context than in the
> > context of an extension function.
> >
> You are absolutely right. But in my case, where I am trying to follow
> the specs of exslt.org, I need it to be in a function. The syntax for
> "match" function can be found at
> http://www.exslt.org/regexp/functions/match/index.html. If I am going to
> implement this natively then I need the xslt code to be portable,
> therefore it has to follow the specs.
I missed the fact that you're implementing the EXSLT regexp:match function
specifically. It's not clear to me why that function would need to have
access to the content of the xsl:for-each element. Isn't it purely a
function of its arguments?
I suggest you take a look at the ExsltStrings.tokenize method, which
implements the str:tokenize function, for ideas - though I know that
implementation has a memory leak. See [1] for details.
I hope that helps.
Thanks,
Henry
[1] http://issues.apache.org/jira/browse/XALANJ-2215
------------------------------------------------------------------
Henry Zongaro XSLT Processors Development
IBM SWS Toronto Lab T/L 313-6044; Phone +1 905 413-6044
mailto:[EMAIL PROTECTED]