cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Calling Stylesheet using Parameter
Date Thu, 12 Apr 2001 14:43:22 GMT


what you have is basically correct, except that the <xsp:pi> element needs
to be nested inside the single element inside the <xsp:page> element,
instead of directly inside the <xsp:page> itself.  Also,
request.getQueryString() doesn't want any parameters, I think.  It returns
the entire query string, so you just put ?style.xsl at the end of your URL
and getQueryString() returns "style.xsl".  A better way, if I mag suggest
it, is to use the request taglib to get named parameters, e.g., if your
request URL looks like ...?stylesheet=style.xsl then you can use
<request:get-parameter name="stylesheet"/> to get back the value

try this code with a URL like "http://.../test.xml?stylesheet=style.xsl":
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>

  <xsp:pi target="xml-stylesheet">
    href="<xsp:expr><request:get-parameter name="stylesheet"/></xsp:expr>"


Also, I've found it easier in some ways to do the stylesheet redirection in
a stylesheet.  That is, hardcode the xml file to go to some standard
stylesheet that then directs the processing on to another stylesheet as per
your query parameters, or to a default stylesheet or whatever.  The FAQ
shows both ways.


Please respond to

To:   "Users, Cocoon" <>

Subject:  Calling Stylesheet using Parameter

I apologize if this question is covered elsewhere but I cannot get it to
work. The faq example appears to be incomplete.
I am trying to open a stylesheet by passing a parameter as follows:

<A HREF="http://.../page.xml?stylesheet=http://.../style.xsl">
and then using xsp as follows in the file page.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<xsp:page xmlns:xsp=""
     <xsp:pi target="xml-stylesheet">
  type="text/xsl" media="explorer"</xsp:pi>
I have tried many variations on this theme without success. Can anyone
help with syntax that works?
David Allen

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message