You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by darul <da...@gmail.com> on 2012/03/05 10:27:43 UTC

XSLT Response Writer and content transformation

Hello,

Using native XSLT Response Writer, we may need to alter content before
processing xml solr output as a RSS Feed.

Example (trivial one...):

<doc>
  <str name="title">bla bla bla </str>
</doc>

After processing content:

<doc>
  <str name="title">bla bla bla bla bla bla bla bla bla bla bla bla</str>
</doc>

Have you any ideas on how to implement a custom function in xslt or before
in XsltResponseWriter.

I would like get this code in a java class and call it for content
processing....

Thanks,

Jul

--
View this message in context: http://lucene.472066.n3.nabble.com/XSLT-Response-Writer-and-content-transformation-tp3800251p3800251.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: XSLT Response Writer and content transformation

Posted by darul <da...@gmail.com>.
Finally get success to make it while upgrading transformer to use Saxon, I
will give you details soon, it can be useful and is nice feature to get nice
rss feed.

--
View this message in context: http://lucene.472066.n3.nabble.com/XSLT-Response-Writer-and-content-transformation-tp3800251p3807212.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: XSLT Response Writer and content transformation

Posted by darul <da...@gmail.com>.
also tried :

  <xsl:template match="doc/description">
	<xsl:apply-templates select="ev:processContent(.)"/>
  </xsl:template>

to get my description content processed, but no success until now ;)

--
View this message in context: http://lucene.472066.n3.nabble.com/XSLT-Response-Writer-and-content-transformation-tp3800251p3804528.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: XSLT Response Writer and content transformation

Posted by darul <da...@gmail.com>.
Well, by default solr distribution is using xalan ? 

- I have created my custom class mypackage.XsltCustomFunctions, with my
custom method processContent(), put jar in jetty/lib root directory.
- update my rss.xsl file by adding
xmlns:ev="xalan://mypackage.XsltCustomFunctions" in header
- try this syntax : <xsl:value-of select="ev:processContent('bla bla bla
bla')" />

get this nice exception java.lang.RuntimeException: getTransformer fails in
getContentType

I not get solr dev environnement to see where it comes from, have you any
idea. 

I do not think it is a classpath problem but a syntax one.



--
View this message in context: http://lucene.472066.n3.nabble.com/XSLT-Response-Writer-and-content-transformation-tp3800251p3804473.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: XSLT Response Writer and content transformation

Posted by darul <da...@gmail.com>.
Thanks Matthew, your solution is what I was looking for.

--
View this message in context: http://lucene.472066.n3.nabble.com/XSLT-Response-Writer-and-content-transformation-tp3800251p3803523.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: XSLT Response Writer and content transformation

Posted by Matthew Parker <mp...@apogeeintegration.com>.
You can embed custom Java functions in XSLT:

http://cafeconleche.org/books/xmljava/chapters/ch17s03.html


On Mon, Mar 5, 2012 at 4:27 AM, darul <da...@gmail.com> wrote:

> Hello,
>
> Using native XSLT Response Writer, we may need to alter content before
> processing xml solr output as a RSS Feed.
>
> Example (trivial one...):
>
> <doc>
>  <str name="title">bla bla bla </str>
> </doc>
>
> After processing content:
>
> <doc>
>  <str name="title">bla bla bla bla bla bla bla bla bla bla bla bla</str>
> </doc>
>
> Have you any ideas on how to implement a custom function in xslt or before
> in XsltResponseWriter.
>
> I would like get this code in a java class and call it for content
> processing....
>
> Thanks,
>
> Jul
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/XSLT-Response-Writer-and-content-transformation-tp3800251p3800251.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

------------------------------
This e-mail and any files transmitted with it may be proprietary.  Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of Apogee Integration.