You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by "P. Redivo" <pr...@asetechs.fr> on 2002/10/22 16:44:25 UTC

Using Xindice with a XSLT template

Hi,

I would like to know whether it is possible to perform queries to an 
Xindice db from a XSLT template?
Is there some information available about this?



Thanks
Pat


RE: Using Xindice with a XSLT template

Posted by Antony Quinn <an...@caret.cam.ac.uk>.
Pat,

1. Write a servlet to query Xindice - let's say you call it like this:
http://localhost/servlet/pat?id=4
2. Call the servlet from your XSLT template using the XPath document( )
function, e.g.
    <xsl:variable name="result"
select="document('http://localhost/servlet/pat?id=4')"/>
3. The XSLT variable 'result' now holds a node set, which is the XML
returned by your 'pat' servlet. You can now query your variable using XPath,
e.g.
    <xsl:value-of select="$result/book[@author='Aldous Huxley']/@title"/>

I've not tried this so I'd be interested to know how you get on.

Bonne chance,

Antony

-----Original Message-----
From: P. Redivo [mailto:predivo@asetechs.fr]
Sent: 22 October 2002 15:44
To: xindice-users@xml.apache.org
Subject: Using Xindice with a XSLT template


Hi,

I would like to know whether it is possible to perform queries to an
Xindice db from a XSLT template?
Is there some information available about this?



Thanks
Pat



Re: Using Xindice with a XSLT template

Posted by Alex McLintock <al...@OWAL.co.uk>.
At 15:44 22/10/02, P. Redivo wrote:
>I would like to know whether it is possible to perform queries to an 
>Xindice db from a XSLT template?
>Is there some information available about this?


I'm not sure exactly what you mean.

But you should probably consider looking at Apache Cocoon which is 
essentially an XML publishing system which includes XSLT, and can use 
XIndice as a data source.

It isn't a terribly good example but this page here is generated using XSLT 
and Xindice

http://news.diversebooks.com/draft/cocoon/reviews/authors/home.section.shtml

My database is essentially a collection of book reviews, and this page 
lists all the authors, and counts them. I use XSLT to transform the results.



Alex




Openweb Analysts Ltd, London.
Software For Complex Websites http://www.OWAL.co.uk/
Open Source Software Companies please register here 
http://www.OWAL.co.uk/oss_support/