You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Ivan Bogouchev / Иван Богушев <iv...@gmail.com> on 2005/09/07 19:37:01 UTC
str:encode-uri()
Hi all,
docs on say that Xalan-C implements the exslt encode-uri() function, but I
the following stylesheet does not work for me (Xalan 1.9).
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="
1.0"
xmlns:str="http://exslt.org/strings">
<xsl:template match="/">
<xsl:value-of select="str:encode-uri(' :|.xml')"/>
</xsl:template>
</xsl:stylesheet>
Can you point me the problem or any other solution to escape strings with
xalan?
--
--Ivan--
Re: str:encode-uri()
Posted by Mark Weaver <ma...@npsl.co.uk>.
David Bertoni wrote:
> Ivan Bogouchev / Иван Богушев wrote:
>> Hi David,
>>
>>
>> 2005/9/8, david_n_bertoni@us.ibm.com <da...@us.ibm.com>:
>>
>>>> Tthanks for the reply, Dave, it that made the stylesheet work.
>>>>
>>>> Just one more question: what about the str:replace() function?
>>>> It seems it is not implemented in xalan-c 1.9.
>>>
>>> None of the EXSLT functions that require returning node-sets are
>>> implemented, because there's no public way to create them.
>>
This is the dynamic nodesets patch that I've been using since about 1.4
updated for 1.10. I expect there's still something to be done with the
new memory manager stuff that I haven't figured out yet.
Re: str:encode-uri()
Posted by David Bertoni <db...@apache.org>.
Ivan Bogouchev / Иван Богушев wrote:
> Hi David,
>
>
> 2005/9/8, david_n_bertoni@us.ibm.com <da...@us.ibm.com>:
>
>>>Tthanks for the reply, Dave, it that made the stylesheet work.
>>>
>>>Just one more question: what about the str:replace() function?
>>>It seems it is not implemented in xalan-c 1.9.
>>
>>None of the EXSLT functions that require returning node-sets are
>>implemented, because there's no public way to create them.
>
>
> Actually after digging a while, what I do in order to create a node-set is:
>
> /* pseudo code */
> create a xalan document (either parse an xsltsource or via document builder)
>
> BorrowReturnMutableNodeRefList mnl(executionContext);
> mnl->addNodeInDocOrder(theXalanDocument, executionContext);
> mnl->setDocumentOrder();
> return executionContext.getXObjectFactory().createNodeSet(mnl);
>
> and it actually works.
> Is there a problem with this?
> What do you mean by "no public way to create node-sets"?
>
Creating a node-set with a single document node in it is one thing, but
creating arbitrary result tree fragments is not trivial to do.
Dave
Re: str:encode-uri()
Posted by Ivan Bogouchev / Иван Богушев <iv...@gmail.com>.
Hi David,
2005/9/8, david_n_bertoni@us.ibm.com <da...@us.ibm.com>:
> > Tthanks for the reply, Dave, it that made the stylesheet work.
> >
> > Just one more question: what about the str:replace() function?
> > It seems it is not implemented in xalan-c 1.9.
>
> None of the EXSLT functions that require returning node-sets are
> implemented, because there's no public way to create them.
Actually after digging a while, what I do in order to create a node-set is:
/* pseudo code */
create a xalan document (either parse an xsltsource or via document builder)
BorrowReturnMutableNodeRefList mnl(executionContext);
mnl->addNodeInDocOrder(theXalanDocument, executionContext);
mnl->setDocumentOrder();
return executionContext.getXObjectFactory().createNodeSet(mnl);
and it actually works.
Is there a problem with this?
What do you mean by "no public way to create node-sets"?
--
--ivan--
Re: str:encode-uri()
Posted by da...@us.ibm.com.
> Tthanks for the reply, Dave, it that made the stylesheet work.
>
> Just one more question: what about the str:replace() function?
> It seems it is not implemented in xalan-c 1.9.
None of the EXSLT functions that require returning node-sets are
implemented, because there's no public way to create them.
You could add an issue to Jira to request an enhancement.
Dave
Re: str:encode-uri()
Posted by Ivan Bogouchev / Иван Богушев <iv...@gmail.com>.
2005/9/7, david_n_bertoni@us.ibm.com <da...@us.ibm.com>:
>
> > docs on say that Xalan-C implements the exslt encode-uri() function,
> > but I the following stylesheet does not work for me (Xalan 1.9).
> >
> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0"
> > xmlns:str="http://exslt.org/strings">
> >
> > <xsl:template match="/">
> > <xsl:value-of select="str:encode-uri(' :|.xml')"/>
> > </xsl:template>
> >
> > </xsl:stylesheet>
>
> This is a bug in your stylesheet, along with a bug in the official EXSLT
> documentation for this function. The EXSLT web site states the function
> encode-uri() has the following signature:
>
> string encode-uri(string, string, string?)
>
> However, according to description of the function on the implementer page,
> the signature should be:
>
> string encode-uri(string, boolean, string?)
>
> See:
>
> http://www.exslt.org/str/functions/encode-uri/str.encode-uri.html
>
> So, you need to supply at least two arguments to the function, which is
> what the error message states.
>
> Dave
>
Tthanks for the reply, Dave, it that made the stylesheet work.
Just one more question: what about the str:replace() function? It seems it
is not implemented in xalan-c 1.9.
Regards,
--
--Ivan--
Re: str:encode-uri()
Posted by da...@us.ibm.com.
> docs on say that Xalan-C implements the exslt encode-uri() function,
> but I the following stylesheet does not work for me (Xalan 1.9).
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
> xmlns:str="http://exslt.org/strings">
>
> <xsl:template match="/">
> <xsl:value-of select="str:encode-uri(' :|.xml')"/>
> </xsl:template>
>
> </xsl:stylesheet>
This is a bug in your stylesheet, along with a bug in the official EXSLT
documentation for this function. The EXSLT web site states the function
encode-uri() has the following signature:
string encode-uri(string, string, string?)
However, according to description of the function on the implementer page,
the signature should be:
string encode-uri(string, boolean, string?)
See:
http://www.exslt.org/str/functions/encode-uri/str.encode-uri.html
So, you need to supply at least two arguments to the function, which is
what the error message states.
Dave