cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conal Tuohy" <con...@paradise.net.nz>
Subject RE: !!! NEED HELP for Passing request parameters - and making use of them in the XSL
Date Wed, 07 May 2003 11:30:12 GMT
Lenya's example is correct AFAIK:

<map:match pattern="archives/**">
   ...
   <map:transform src="my.xsl" type="xslt">
      <map:parameter name="param" value="{1}">
   </map:transform>
   ...
</map:match>

In the XLST:

   ...
   <xsl:param name="param"/>
   ---
   <xsl:value-of select="$param"/>

Note the $ in the value-of expression (I think this is Lenya's mistake -
<xsl:value-of select="param"> will refer to a probably non-existent <param>
element, and return an empty string).

AFAIK you can't really use an XPath expression passed this way. The XSLT
parameter will be a string, and there's no way to evaluate that as a kind of
macro in XSLT. If your XPath expression was always in some simple format
like "id('foo')" or "/foo[1]/bar[3]/baz[2]" it would be easy to parse, but
for general XPath you don't want to parse it in XSLT!!!

You could try using the XIncludeTransformer, or the XPathTransformer in
Forrest, more like it.

Cheers

Con

> -----Original Message-----
> From: cavallino_mail.zeelandnet.nl [mailto:cavallino@zeelandnet.nl]
> Sent: Wednesday, 18 December 2002 21:53
> To: cocoon-users@xml.apache.org
> Subject: !!! NEED HELP for Passing request parameters - and making use
> of them in the XSL
>
>
> I want to do that too but then with XPath. I want to
> transform my Xpath
> results into HTML.
>
> In IExplore I go to an URL which contains xpath parameters.
> Then when I don't
> put in a transform or anything like that I just get a page in
> XML with the
> results of my query. In that case XPath has added a couple
> attributes to the
> result like the locations and the filenames of the results. I
> need that
> information for my stylesheet.
> Now I need to transform that automatically into HTML. But I
> have no idea how
> to do that. I tried just using a transform but if I do that
> it shows the
> stylesheet without the XML page I had without the
> transformation. So the
> result table I made in the stylesheet is shown but there's no
> data in it.
> I can't just pass the XPath parameters that only contains my
> query and I need
> the results to. Or can I do that some way?
>
> Can anyone help because I need to solve this very badly, thanx
>
> Sebastiaan
>
> >===== Original Message From "Lenya L. Khachaturov"
> <lenya@chemsell.yaroslavl.ru> =====
> >Hello,
> >
> >It seems like everybody knows how to do this, at least the
> docs mention
> >this so briefly, that it must be dead simple. Anyway, I
> didn't get it :-)
> >Please help me on this:
> >
> ><map:match pattern="archives/**">
> >...
> ><map:transform src="my.xsl" type="xslt">
> >  <map:parameter name="param" value="{1}">
> ></map:transform>
> >...
> ></map:match>
> >
> >Now, when I point the browser to http://mysite/archives/december,
> >the parameter named "param" with the "december" value should
> be passed to
> >the stylesheet. In the stylesheet I have: <xsl:param name="param" />
> >As far as I understood, <xsl:value-of select="param"> should print
> >"december" - right? Well, it doesn't. What am I doing wrong?
> >
> >--
> >Lenya Khachaturov
> >mailto:lenya@chemsell.yaroslavl.ru
> >
> >---------------------------------------------------------------------
> >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:     <cocoon-users-unsubscribe@xml.apache.org>
> >For additional commands, e-mail:   <cocoon-users-help@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:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Mime
View raw message