Re: How to configure TraxProcessor in 2.2?
gelo1234 <[email protected]> Fri, 6 Dec 2019 09:04:42 +0100
| Newsgroups | gmane.text.xml.cocoon.user |
|---|---|
| Message-ID | <CAPJaKUr3ECyxnLBTjOWCGvDnDFvVGhpaor-TnZY0Gr65fCRnsg@mail.gmail.com> |
--00000000000033173e05990480fa Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Mark, Also make sure, you have that class: org.dspace.saxon.ConfigurableTransformerFactory available on the CLASSPATH (-> WEB-INF/lib/*.jar) And a proper version/config for Saxon HE. Here is the guide: https://stackoverflow.com/questions/22483436/using-saxon9-for-xslt-with-apa= che-cocoon-2-2 Greetings, Greg czw., 5 gru 2019 o 16:13 Javier Puerto <[email protected]> napisa=C5=82(a): > Hi Mark, > > I recommend you to use the Spring configuration. I never had this > requirement before but by the error message and the configuration fragmen= t > that you have sent the NPE is caused because you are not passing an > instance of "org.dspace.saxon.ConfigurableTransformerFactory", you are > passing a String instead. > > <property name=3D'transformerFactory' > value=3D'org.dspace.saxon.ConfigurableTransformerFactory'= /> > > IIRC you should change it to: > <property name=3D'transformerFactory'> > <bean class=3D"org.dspace.saxon.ConfigurableTransformerFactory"/> > </property> > > The attribute "value" is for literal values. You can also define the bean > with an ID and then use the attribute "ref" with the ID of the bean. > I hope that helps. > > Salu2. > > El mi=C3=A9., 4 dic. 2019 a las 22:46, Mark H. Wood (<[email protected]>) > escribi=C3=B3: > >> I'm using Cocoon 2.2. I need to pass a custom XSLT transformer >> factory (that wraps Saxon's to configure it) to TraxProcessor, and the >> advice I've found in several places around the Web doesn't seem to be >> working: my factory class never gets instantiated. >> >> I've got a file META-INF/cocoon/avalon/cocoon-core-saxon-xslt.xconf: >> >> <?xml version=3D"1.0" encoding=3D"UTF-8"?> >> <components> >> <component role=3D"org.apache.excalibur.xml.xslt.XSLTProcessor/saxon" >> class=3D"org.apache.cocoon.components.xslt.TraxProcessor"> >> <parameter name=3D"use-store" value=3D"true"/> >> <parameter name=3D"transformer-factory" >> value=3D"org.dspace.saxon.ConfigurableTransformerFactory"= /> >> </component> >> </components> >> >> I also tried copying it to WEB-INF/cocoon and it didnt' seem to work >> there either. >> >> I do have <configurator:settings/> and <avalon:bridge/> in the Spring >> config. >> >> Is there some way to debug component configuration and see if the file >> is even being looked for (and where *is* configuration looking)? The >> Cocoon site directs me to Excalibur, which directs me to Avalon, which >> says that Avalon is wound up and directs me back to Excalibur.... >> >> >> >> I've also tried to configure the thing using Spring: >> >> <bean name=3D'org.apache.excalibur.xml.xslt.XSLTProcessor/saxon' >> class=3D'org.apache.cocoon.components.xslt.TraxProcessor' >> init-method=3D'initialize' >> destroy-method=3D'dispose'> >> <!--property name=3D'use-store' value=3D'true'/--> >> <property name=3D'transformerFactory' >> value=3D'org.dspace.saxon.ConfigurableTransformerFactory= '/> >> </bean> >> >> but so far I'm missing something: TraxProcessor.sourceToSAX throws an >> NPE. I'm probably not setting the parameters correctly -- there isn't >> a setter for use-store at all, for example. >> >> I've found any number of pages that tell me Avalon configuration is >> being replaced by Spring, but nothing practical on how to convert >> Avalon configuration (such as the first sample above) to Spring, or >> even how to write fresh Spring configuration for Cocoon components. >> It would be nice to know how to do this even if I wind up using the >> Avalon approach with the present task. >> >> -- >> Mark H. Wood >> Lead Technology Analyst >> >> University Library >> Indiana University - Purdue University Indianapolis >> 755 W. Michigan Street >> Indianapolis, IN 46202 >> 317-274-0749 >> www.ulib.iupui.edu >> > --00000000000033173e05990480fa Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-size:small">Hi = Mark,</div><div class=3D"gmail_default" style=3D"font-size:small"><br></div= ><div class=3D"gmail_default" style=3D"font-size:small">Also make sure, you= have that class: org.dspace.saxon.ConfigurableTransformerFactory available= on the CLASSPATH (-> WEB-INF/lib/*.jar)</div><div class=3D"gmail_defaul= t" style=3D"font-size:small">And a proper version/config for Saxon HE. Here= is the guide:</div><div class=3D"gmail_default" style=3D"font-size:small">= <a href=3D"https://stackoverflow.com/questions/22483436/using-saxon9-for-xs= lt-with-apache-cocoon-2-2">https://stackoverflow.com/questions/22483436/usi= ng-saxon9-for-xslt-with-apache-cocoon-2-2</a></div><div class=3D"gmail_defa= ult" style=3D"font-size:small"><br></div><div class=3D"gmail_default" style= =3D"font-size:small">Greetings,</div><div class=3D"gmail_default" style=3D"= font-size:small">Greg<br></div><div class=3D"gmail_default" style=3D"font-s= ize:small"><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" = class=3D"gmail_attr">czw., 5 gru 2019 o 16:13=C2=A0Javier Puerto <<a hre= f=3D"mailto:[email protected]">[email protected]</a>> napisa=C5=82(a):<b= r></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex= ;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">= <div>Hi Mark,</div><div><br></div><div>I recommend you to use the Spring co= nfiguration. I never had this requirement before but by the error message a= nd the configuration fragment that you have sent the NPE is caused because = you are not passing an instance of "org.dspace.saxon.ConfigurableTrans= formerFactory", you are passing a String instead.</div><div><br></div>= <div><property name=3D'transformerFactory'<br>=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 value=3D'org.dspace.saxon.Config= urableTransformerFactory'/><br></div><div><br></div><div>IIRC you sh= ould change it to:</div><div><property name=3D'transformerFactory= 9;><br></div><div>=C2=A0 <bean class=3D"org.dspace.saxon.Configu= rableTransformerFactory"/></div><div></property></div><div><b= r></div><div>The attribute "value" is for literal values. You can= also define the bean with an ID and then use the attribute "ref"= with the ID of the bean.</div><div>I hope that helps.</div><div><br></div>= <div>Salu2.</div><div><br></div><div class=3D"gmail_quote"><div dir=3D"ltr"= class=3D"gmail_attr">El mi=C3=A9., 4 dic. 2019 a las 22:46, Mark H. Wood (= <<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a= >>) escribi=C3=B3:<br></div><blockquote class=3D"gmail_quote" style=3D"m= argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left= :1ex">I'm using Cocoon 2.2.=C2=A0 I need to pass a custom XSLT transfor= mer<br> factory (that wraps Saxon's to configure it) to TraxProcessor, and the<= br> advice I've found in several places around the Web doesn't seem to = be<br> working:=C2=A0 my factory class never gets instantiated.<br> <br> I've got a file META-INF/cocoon/avalon/cocoon-core-saxon-xslt.xconf:<br= > <br> <?xml version=3D"1.0" encoding=3D"UTF-8"?><br> <components><br> =C2=A0 <component role=3D"org.apache.excalibur.xml.xslt.XSLTProcess= or/saxon"<br> =C2=A0 =C2=A0 class=3D"org.apache.cocoon.components.xslt.TraxProcessor= "><br> =C2=A0 =C2=A0 <parameter name=3D"use-store" value=3D"true= "/><br> =C2=A0 =C2=A0 <parameter name=3D"transformer-factory"<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0value=3D"org.ds= pace.saxon.ConfigurableTransformerFactory"/><br> =C2=A0 </component><br> </components><br> <br> I also tried copying it to WEB-INF/cocoon and it didnt' seem to work<br= > there either.<br> <br> I do have <configurator:settings/> and <avalon:bridge/> in the = Spring<br> config.<br> <br> Is there some way to debug component configuration and see if the file<br> is even being looked for (and where *is* configuration looking)?=C2=A0 The<= br> Cocoon site directs me to Excalibur, which directs me to Avalon, which<br> says that Avalon is wound up and directs me back to Excalibur....<br> <br> <br> <br> I've also tried to configure the thing using Spring:<br> <br> =C2=A0 =C2=A0 <bean name=3D'org.apache.excalibur.xml.xslt.XSLTProces= sor/saxon'<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 class=3D'org.apache.cocoon.component= s.xslt.TraxProcessor'<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 init-method=3D'initialize'<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 destroy-method=3D'dispose'><b= r> =C2=A0 =C2=A0 =C2=A0 <!--property name=3D'use-store' value=3D= 9;true'/--><br> =C2=A0 =C2=A0 =C2=A0 <property name=3D'transformerFactory'<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 value=3D'org.ds= pace.saxon.ConfigurableTransformerFactory'/><br> =C2=A0 =C2=A0 </bean><br> <br> but so far I'm missing something:=C2=A0 TraxProcessor.sourceToSAX throw= s an<br> NPE.=C2=A0 I'm probably not setting the parameters correctly -- there i= sn't<br> a setter for use-store at all, for example.<br> <br> I've found any number of pages that tell me Avalon configuration is<br> being replaced by Spring, but nothing practical on how to convert<br> Avalon configuration (such as the first sample above) to Spring, or<br> even how to write fresh Spring configuration for Cocoon components.<br> It would be nice to know how to do this even if I wind up using the<br> Avalon approach with the present task.<br> <br> -- <br> Mark H. Wood<br> Lead Technology Analyst<br> <br> University Library<br> Indiana University - Purdue University Indianapolis<br> 755 W. Michigan Street<br> Indianapolis, IN 46202<br> 317-274-0749<br> <a href=3D"http://www.ulib.iupui.edu" rel=3D"noreferrer" target=3D"_blank">= www.ulib.iupui.edu</a><br> </blockquote></div></div> </blockquote></div> --00000000000033173e05990480fa--