You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by funing <fu...@necas.nec.co.jp> on 2002/09/27 11:03:48 UTC
How to filter the data according to the user input?
Hi!
I have a xml contains such data:
<isodocs>
<doc category="jpg">
<name>14_84_1.jpg</name>
<description>a nice pic</description>
<location>14_84_1.jpg</location>
</doc>
<doc category="jpg">
<name>847_2.jpg</name>
<description>a dog and a cat</description>
<location>847_2.jpg</location>
</doc>
<doc category="bmp">
<name>14_84_1.bmp</name>
<description>this is a bmp</description>
<location>14_84_1.jpg</location>
</doc>
<doc category="bmp">
<name>14_84_2.bmp</name>
<description>this is another bmp</description>
<location>14_84_1.jpg</location>
</doc>
</isodocs>
How can I let only those items whose category="jpg" be showed ?
Thanks a lot!
best regards
--
funing <fu...@necas.nec.co.jp>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: How to filter the data according to the user input?
Posted by Luca Morandini <lu...@tin.it>.
Funing,
no problem, you just pass a parameter (named, say, "select-cat") to your stylesheet from the sitemap, and then use that parameter
value to select a category; hence, your stylesheet may look like:
<map:param name="selected-cat"/>
<xsl:template match="isodocs/doc[@category=$select-cat]">
<xsl:copy-of select="."/>
</xsl:template>
To pass the "select-cat" request parameter to that stylesheet you may use "use-request-parameters" in your sitemap.
Best regards,
---------------------------------------------
Luca Morandini
GIS Consultant
lmorandini@ieee.org
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------
> -----Original Message-----
> From: funing [mailto:funing@necas.nec.co.jp]
> Sent: Friday, September 27, 2002 12:26 PM
> To: cocoon-users@xml.apache.org; lmorandini@ieee.org
> Subject: Re: How to filter the data according to the user input?
>
>
> Thank you.
> But, it is my fault not to state the question clearly, I need a
> dynamical generation.That is, which category to show is decided
> by user. It seems that I must use logic sheet, right?
>
>
> On Fri, 27 Sep 2002 11:23:37 +0200
> "Luca Morandini" <lu...@tin.it> wrote:
>
> >
> > I think a little XSLT could do the job, something along these lines:
> >
> > <xsl:template match="isodocs/doc[@category='jpg']">
> > <xsl:copy-of select="."/>
> > </xsl:template>>
> --
> funing <fu...@necas.nec.co.jp>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: How to filter the data according to the user input?
Posted by funing <fu...@necas.nec.co.jp>.
Thank you.
But, it is my fault not to state the question clearly, I need a
dynamical generation.That is, which category to show is decided
by user. It seems that I must use logic sheet, right?
On Fri, 27 Sep 2002 11:23:37 +0200
"Luca Morandini" <lu...@tin.it> wrote:
>
> I think a little XSLT could do the job, something along these lines:
>
> <xsl:template match="isodocs/doc[@category='jpg']">
> <xsl:copy-of select="."/>
> </xsl:template>
--
funing <fu...@necas.nec.co.jp>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: How to filter the data according to the user input?
Posted by Luca Morandini <lu...@tin.it>.
funing,
I think a little XSLT could do the job, something along these lines:
<xsl:template match="isodocs/doc[@category='jpg']">
<xsl:copy-of select="."/>
</xsl:template>
Wrap it into a stylesheet and put this stage into your pipeline, it will act as a filter.
Best regards,
P.S.
I wrote this piece of code without testing it first... be aware !
---------------------------------------------
Luca Morandini
GIS Consultant
lmorandini@ieee.org
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------
> -----Original Message-----
> From: funing [mailto:funing@necas.nec.co.jp]
> Sent: Friday, September 27, 2002 11:04 AM
> To: cocoon-users@xml.apache.org
> Subject: How to filter the data according to the user input?
>
>
> Hi!
> I have a xml contains such data:
>
> <isodocs>
> <doc category="jpg">
> <name>14_84_1.jpg</name>
> <description>a nice pic</description>
> <location>14_84_1.jpg</location>
> </doc>
> <doc category="jpg">
> <name>847_2.jpg</name>
> <description>a dog and a cat</description>
> <location>847_2.jpg</location>
> </doc>
> <doc category="bmp">
> <name>14_84_1.bmp</name>
> <description>this is a bmp</description>
> <location>14_84_1.jpg</location>
> </doc>
> <doc category="bmp">
> <name>14_84_2.bmp</name>
> <description>this is another bmp</description>
> <location>14_84_1.jpg</location>
> </doc>
> </isodocs>
>
> How can I let only those items whose category="jpg" be showed ?
>
> Thanks a lot!
>
> best regards
> --
> funing <fu...@necas.nec.co.jp>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>