I've tried in both ESB 4.0.3 and 4.5.0, but it gives me the same error. I've checked the code I've posted with an on-line XSLT test tool and it gives the desired output without any error. Three parameter version of the key() function which is in the XSLT 2.0 specifications, is also not working in the XSLT mediator in ESB.
Thanks, Nipuni On Tue, Jun 26, 2012 at 12:33 PM, Chintana Wilamuna <chint...@wso2.com>wrote: > I've enabled Saxon on ESB 4.0.3. Following XSLT works without any issue. > > -Chintana > > On Mon, Jun 25, 2012 at 6:44 PM, Nipuni Perera <nip...@wso2.com> wrote: > >> Hi, >> >> This is the sample that I have tested in the ESB-4.5.0. SNAPSHOT. I >> crated custom proxy service and gave the path to XSLT document as follows: >> >> <proxy xmlns="http://ws.apache.org/ns/synapse" name="CustomProxy" >> transports="https,http" statistics="disable" trace="disable" >> startOnLoad="true"> >> <target> >> <inSequence> >> <xslt key="gov:/event/mapping.xslt" /> >> <log level="full" /> >> </inSequence> >> </target> >> <description></description> >> </proxy> >> >> *XML document:* >> >> <students> >> <student> >> <name>Paul</name> >> <subjects> >> <subject> >> <name>Physics</name> >> </subject> >> <subject> >> <name>Chemistry</name> >> </subject> >> </subjects> >> </student> >> <student> >> <name>Alice</name> >> <subjects> >> <subject> >> <name>Maths</name> >> </subject> >> <subject> >> <name>Chemistry</name> >> </subject> >> </subjects> >> </student> >> <student> >> <name>Bob</name> >> <subjects> >> <subject> >> <name>Art</name> >> </subject> >> <subject> >> <name>Econ</name> >> </subject> >> </subjects> >> </student> >> </students> >> >> *XSLT transformation:* >> >> <?xml version="1.0" encoding="UTF-8"?> >> <xsl:stylesheet version="2.0" xmlns:xsl=" >> http://www.w3.org/1999/XSL/Transform" xmlns:xs=" >> http://www.w3.org/2001/XMLSchema" xmlns:fn=" >> http://www.w3.org/2005/xpath-functions" exclude-result-prefixes="xs fn"> >> >> <xsl:output method="xml" indent="yes"/> >> >> <xsl:key name="keyStudents" match="students/student" >> use="subjects/subject/name" /> >> >> <xsl:template match="/"> >> >> <subjects> >> <xsl:attribute name="xsi:noNamespaceSchemaLocation" namespace=" >> http://www.w3.org/2001/XMLSchema-instance"/> >> >> <xsl:variable name="pathToName" >> select="students/student/subjects/subject"/> >> <xsl:variable name="studentName" select="students/student/name"/> >> <xsl:variable name="root" select="/"/> >> >> >> <xsl:for-each >> select="distinct-values(/students/student/subjects/subject/name)"> >> <subject> >> >> <xsl:variable name="currentSubject" select="."/> >> <name> >> <xsl:value-of select="$currentSubject"/> >> >> </name> >> <students> >> <xsl:for-each >> select="key('keyStudents',$currentSubject,$root)"> >> >> <student> >> <name> >> <xsl:value-of select="name"/> >> </name> >> </student> >> >> </xsl:for-each> >> </students> >> </subject> >> </xsl:for-each> >> >> >> </subjects> >> </xsl:template> >> </xsl:stylesheet> >> >> >> It gives the following error: >> >> >> ERROR - XSLTMediator Fatal error occurred in stylesheet parsing : >> javax.xml.transform.TransformerException: Could not find function: >> distinct-values >> >> Thanks, >> Nipuni >> >> On Mon, Jun 25, 2012 at 1:50 PM, Nipuni Perera <nip...@wso2.com> wrote: >> >>> Hi, >>> >>> I tried the above mentioned steps but it didn't work. I also build ESB >>> from trunk but it gives the same error as ESB-4.0.3. >>> >>> Thanks, >>> Nipuni >>> >>> On Thu, Jun 21, 2012 at 8:59 PM, Achala Aponso <ach...@wso2.com> wrote: >>> >>>> Hi, >>>> >>>> Following steps will provide Xpath 2.0 support for ESB 4.0.3 >>>> >>>> 1. Remove xalan-2.7.0.wso2v1.jar in ESB_HOME/lib/endorsed/ >>>> 2. Remove saxon-8.9.0.wso2v1.jar from >>>> ESB_HOME/repository/components/plugins >>>> 3. Copy the saxon9he.jar (which is available at [1]) to lib/endorsed >>>> and start the server. >>>> >>>> [1] >>>> http://sourceforge.net/projects/saxon/files/Saxon-HE/9.4/SaxonHE9-4-0-3J.zip/download?use_mirror=nchc >>>> >>>> Thanks, >>>> Achala >>>> >>>> >>>> On Thu, Jun 21, 2012 at 8:45 PM, Afkham Azeez <az...@wso2.com> wrote: >>>> >>>>> If you remove Xalan & use Saxon, you will get XPath 2.0 support in ESB >>>>> 4.0.3. >>>>> >>>>> >>>>> On Thu, Jun 21, 2012 at 4:07 PM, Charitha Kankanamge < >>>>> chari...@wso2.com> wrote: >>>>> >>>>>> AFAIK, ESB-4.0.3 does not support Xpath-2.0 >>>>>> >>>>>> /Charitha >>>>>> >>>>>> On Thu, Jun 21, 2012 at 4:02 PM, Nipuni Perera <nip...@wso2.com>wrote: >>>>>> >>>>>>> Hi Charitha, >>>>>>> >>>>>>> I am trying ESB 4.0.3 >>>>>>> >>>>>>> Thanks, >>>>>>> Nipuni >>>>>>> >>>>>>> >>>>>>> On Thu, Jun 21, 2012 at 3:57 PM, Charitha Kankanamge < >>>>>>> chari...@wso2.com> wrote: >>>>>>> >>>>>>>> Are you trying ESB trunk (4.5.0) or an older version? Xpath-2.0 is >>>>>>>> supported by ESB trunk version. >>>>>>>> >>>>>>>> /Charitha >>>>>>>> >>>>>>>> >>>>>>>> On Thu, Jun 21, 2012 at 3:46 PM, Nipuni Perera <nip...@wso2.com>wrote: >>>>>>>> >>>>>>>>> Hi All, >>>>>>>>> >>>>>>>>> I have tried xml transformation in ESB. But it gave me the >>>>>>>>> following error for xslt function "distinct-values" >>>>>>>>> >>>>>>>>> ERROR - XSLTMediator Fatal error occurred in stylesheet parsing : >>>>>>>>> javax.xml.transform.TransformerException: Could not find function: >>>>>>>>> distinct-values >>>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> Nipuni >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Dev mailing list >>>>>>>>> Dev@wso2.org >>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Dev mailing list >>>>>> Dev@wso2.org >>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> *Afkham Azeez* >>>>> Director of Architecture; WSO2, Inc.; http://wso2.com >>>>> Member; Apache Software Foundation; http://www.apache.org/ >>>>> * <http://www.apache.org/>** >>>>> email: **az...@wso2.com* <az...@wso2.com>* cell: +94 77 3320919 >>>>> blog: **http://blog.afkham.org* <http://blog.afkham.org>* >>>>> twitter: >>>>> **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> >>>>> * >>>>> linked-in: **http://lk.linkedin.com/in/afkhamazeez* >>>>> * >>>>> * >>>>> *Lean . Enterprise . Middleware* >>>>> >>>>> >>>>> _______________________________________________ >>>>> Dev mailing list >>>>> Dev@wso2.org >>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>> >>>>> >>>> >>>> >>>> -- >>>> Achala Aponso >>>> Software Engineer; WSO2 Inc.; http://wso2.com, >>>> Email: ach...@wso2.com Mobile: +94 (77) 5234925 >>>> Blog: http://achala11.blogspot.com/ >>>> >>>> >>>> >>>> _______________________________________________ >>>> Dev mailing list >>>> Dev@wso2.org >>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>> >>>> >>> >> >> _______________________________________________ >> Dev mailing list >> Dev@wso2.org >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > Chintana Wilamuna > Senior Technical Lead > WSO2, Inc.; http://wso2.com > lean.enterprise.middleware > > phone: +94 75 211 1106 > blog: http://engwar.com/ > photos: http://flickr.com/photos/chintana > linkedin: http://www.linkedin.com/in/engwar > twitter: twitter.com/std_err > >
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev