I think you're missing the concept of the cinclude. That transformer will
include, yes that's what you need, but it doesn't do anything more than
that. If you need parameter substitution (eg passing a parameter from
sitemap to your document,session/request parameters,...) you'll need to use
another component that does this. One way is to use another transformer, for
example the XSLT transformer:
<map:generate src=".."/>
<map:transform src="settheparamstylesheet.xslt">
    <map:param name="" value=""/>
</map:transform/>
<map:transform type="cinclude"/>

So set the parameter in the correct tags before calling the include
transformer.

This isn't exactly a good way to do that (well in my eyes of course, if you
only want an xml with an inclusion of a particular file:), I would use a
JXTemplateGenerator (docs in your distrubution under "user docs/flow").With
this generator you'll have access to variables such as the sitemap, request
and session parameters, use this as follows:
<map:generate type="jx" src="myfile.xml">
    <map:param name="myparam" value="myvalue"/>
</map:transform/>
<map:transform type="cinclude"/>

with in myfile.xml:

<bodytag xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
    anything you like....

    <cinclude:include
src="cocoon:/ReadMyFile/${cocoon.parameters.myparam}.xml"/>

</bodytag>

The cocoon:/ is just your protocol you want to use (here it will go through
your current sitemap for a match)
The 'ReadMyFile/' is a uri part to identify a pipeline (see further)
The ${cocoon.parameters.myparam} is one way to access your 'myparam'
parameter passed from your sitemap with the help of the
JXTemplateGenerator.(here using jexl, you may also use jxpath)
Thus when generating your document, the parameter will be filled in by
JXTemplateGenerator and afterwards cinclude will have the correct value to
use.
Remember that if you want to read another file into that location (as in
this example) you'll need another pipeline that matches that file and just
reads in and serializes the content:

eg:
    <map:match pattern="ReadMyFile/*.xml">
        <map:generate src="{1}.xml"/>
        <map:serialize type="xml"/>
    </map:match>

This just reads your file (you may want to do more with that file if you
like, eg another include or styling...) and the include transformer places
the outcome of the pipeline at the <cinclude:..> tag.

(The latter way is not the only way, but seems, in this case, the more
appropriate one to me)

Hope this helps,

Kind Regards,
Jan


----- Original Message ----- 
From: "David Swearingen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 14, 2004 4:37 AM
Subject: Re: (Easy) Passing a Variable From Sitemap to StyleSheet?


> Ok, I see the source of the problem now.  I am trying to resolve the
> value of a variable from within an xml document, not within the
> stylesheet.  I'm using the xml document to collect a bunch of xml
> documents using cinclude.  That's where I need to have the name of a
> file requested in the uri by the user.  So the question becomes how to
> pass the name of a file to a cinclude:include directive inside an xml
> document, if that makes sense.
>
> I will say that this user group is extremely helpful and courteous, the
> Cocoon platform is awesome, and I hope to be able to give back when I
> learn enough to contribute.
>
> David
>
>
> --- Jorg Heymans <[EMAIL PROTECTED]> wrote:
> > in the sitemap you do
> >
> > <map:transform blah...
> >    <map:parameter name="myparam" value="{1}"/>
> > </map:transform>
> >
> > then in your stylesheet do
> > <xsl:param name="myparam"/>
> >
> > David Swearingen wrote:
> > > I thought this would be easy...I'm trying to pass a variable
> > defined in
> > > the Sitemap, and retrieve it in the Stylesheet.
> > >
> > > Specifically, I have {1} defined in the sitemap, which is the
> > basename
> > > of a file, and I want to refer to this filename in a stylesheet
> > that's
> > > called by a transformer.  I'm then going to reference this filename
> > in
> > > the src attribute of a cinclude:include tag in the stylesheet.
> > Need
> > > to know a) how to define it in sitemap and b) how to retrieve it in
> > > stylesheet.
> > >
> > > Thanks,
> > > David
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! Tax Center - File online by April 15th
> > > http://taxes.yahoo.com/filing.html
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - File online by April 15th
> http://taxes.yahoo.com/filing.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to