Hi,

If this is just a cocoon question, then, yes, you would get better help on
cocoon-users. But, if your question is more generic then I think the document()
in XSL is a good way to go (cocoon devs would say it mixes concerns, though).
You just need an URIResolver to handle the requests.

Say you have this in your XSL:

<xsl:variable
  name="xmldb"
  select="document('xmldb:xindice://localhost:4080/db/collection/docNo')"/>

you can also pass an explicit 'base' argument with the document(), e.g.

<xsl:variable
  name="xmldb"
  select="document('xmldb:xindice:docNo', '//localhost:4080/db/collection')"/>

and your resolver could be like:

final class MyURIResolver implements URIResolver {

  public MyURIResolver() {}
/*
- the href is the first argument in the document function or the href attribute
in a xsl:include/import

- if base is not passed then the calling XSL is used as the base
*/

  public Source resolve(String href,String base) {
    if (href.startsWith("xmldb:xindice:") ) {
      return your xindice resource
    } else {
      return a file resource;
    }
  }
}

best,
-Rob

> -----Original Message-----
> From: Josema Alonso [mailto:[EMAIL PROTECTED]
> Sent: Sunday, November 24, 2002 3:34 AM
> To: xindice-users@xml.apache.org
> Subject: Re: How can I access Xindice DB from XSL Stylesheet ?
>
>
> You should create a pipeline for this. First step would be a generator. The
> source of the generator would point to whatever you want using the pseudo
> protocol, and second step would be to use a XSL transformer. If you want to
> access Xindice directly, you could try the eXist logicsheet from a XSP. I
> played around with this a while ago and published my results at:
> http://outerthought.net/wiki/Wiki.jsp?page=XindiceLogicsheet
>
> The last approach I took was accessing Xindice directly from Java inside an
> action.
>
> Maybe this thread is more suitable for Cocoon-Users list, so move it there
> if you want to follow up on this, please.
>
>
> ----- Original Message -----
> From: "B <[EMAIL PROTECTED]>" <[EMAIL PROTECTED]>
> To: <xindice-users@xml.apache.org>
> Sent: Sunday, November 24, 2002 5:32 AM
> Subject: How can I access Xindice DB from XSL Stylesheet ?
>
>
> > Xindice can be accessed by the Apache Cocoon generator using
> > the pseude-protocol specified in sitemap's pipeline. But how
> > can we access xindice DB from the xsl stylesheet?  Ordinally
> > external xml files can be accessed by the document() function
> > in XSL, but when I specified the xindice protocol in the
> > document()'s argument shown bellow, null pointer exception
> > occurred.
> >
> > <xsl:variable name="xmldb" select="document('xmldb:xindice://
> > localhost:4080/db/collection/docNo')"/>
> >
> > Any advice will be appreciated.
> >
> >
> > Yasuhiro Chiba
> > e-mail:[EMAIL PROTECTED]
> >
>


Reply via email to