Cant get this to work.

Here is what I have in my xsl, 
<?xml version="1.0"?>

<!DOCTYPE xsp:stylesheet [
 <!ENTITY nbsp "&#160;">
 <!ENTITY crlf "<xsl:text>&#013;</xsl:text>">
 <!ENTITY copy "&#169;">
]>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">

  <xsl:template match="page">
   <xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>
   <html>
   <head>
    <body>test</body>
   </head>
   </html>
  </xsl:template>
</xsl:stylesheet>

and here is what I have in my XML

<?xml version="1.0"?>
<?xml-stylesheet href="http://localhost/style/acclaim.xsl"; type="text/xsl"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>

<!DOCTYPE xsp:stylesheet [
 <!ENTITY nbsp "&#160;">
 <!ENTITY crlf "<xsl:text>&#013;</xsl:text>">
 <!ENTITY copy "&#169;">
]>

<xsp:page 
  language="java"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core";
  xmlns:request="http://www.apache.org/1999/XSP/Request";
  xmlns:util="http://www.apache.org/1999/XSP/Util";
  
>

<page>
</page>
</xsp:page>

If I add 
<xsp:logic>
if (session == null) {
        response.sendRedirect("loginForm.html")
} else {
        // execute XML 
}
</xsp:logic>

in between my page tags, it works fine, but if I add it into my style sheet 
after this tag <xsl:template match="page">

I get a SaxParseException.

I also dont have a cocoon.xconf file.
And if I make the changes that you recommended, I still have no luck.

Any help would be appreciated.
Thanks
Tony



-----Original Message-----
From: Tsui, Alban [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 8:24 AM
To: [EMAIL PROTECTED]
Subject: RE: XSL Stylesheet question


This is one example that i have:

<?xml version="1.0"?>
<xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:xsp="http://apache.org/xsp";
        xmlns:chart="http://www.abbabbab.com/chart";
        xmlns:xsp-request="http://apache.org/xsp/request/2.0";
        version="1.0">
        
        <xsl:template match="chart:queryparameternames">
                <xsp:logic>
                        java.util.Enumeration params =
request.getParameterNames();
                        java.util.Vector queryparameternames = new
java.util.Vector();
                        while(params.hasMoreElements()) {
                                String name = (String)
(params.nextElement());
                                queryparameternames.addElement( name );
                        }
                </xsp:logic>
        </xsl:template>


</xsl:stylesheet>

It is basically a Cocoon logicsheet/stylesheet.

In your XSP, you have to make sure that the namespace is defined and matches
the one in your logicsheet:

<?cocoon-process type="xsp"?>
<xsp:page 
        xmlns:xsp="http://apache.org/xsp";
        xmlns:xsp-request="http://apache.org/xsp/request/2.0";
        xmlns:chart="http://www.abbabbab.com/chart";
>

        <root>
                <xsp:logic>
                        <chart:queryparameternames>
                        
                        int size = queryparameternames.size();

                        // you can starting using the code from your
logicsheet ....
                </xsp:logic>
        </root>

  </xsp:page>

Also, make sure you logicsheet is recognised by cocoon by adding an entry in
your cocoon.xconf, something like:


        <builtin-logicsheet>
                <parameter name="prefix" value="chart"/>
                <parameter name="uri"
value="http://www.abbabbab.com/chart"/>
                <parameter name="href" value="resource://path/chart.xsl"/>

        </builtin-logicsheet>




> -----Original Message-----
> From: Anthony Diodato [mailto:[EMAIL PROTECTED]]
> Sent: 25 January 2002 13:07
> To: '[EMAIL PROTECTED]'
> Subject: RE: XSL Stylesheet question
> 
> 
> So what do I do, just insert the <xsp:logic> tags into my xsp 
> stylesheet,
> and it will work??
> 
> -----Original Message-----
> From: Tsui, Alban [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 25, 2002 8:02 AM
> To: [EMAIL PROTECTED]
> Subject: RE: XSL Stylesheet question
> 
> 
> Yes this is the simple answer. I have been using this 
> technique for quite a
> while.
> 
> But if you want to check session for user authentication, you 
> might want to
> have a look at Cocoon's ACTION.
> 
> > -----Original Message-----
> > From: Anthony Diodato [mailto:[EMAIL PROTECTED]]
> > Sent: 25 January 2002 13:01
> > To: '[EMAIL PROTECTED]'
> > Subject: XSL Stylesheet question
> > 
> > 
> > Can you put xsp code in your style sheets.
> > 
> > The reason I ask is this.
> > I wrote a form based authentication servlet for my website. The form
> > authenticates the user, and creates a HttpSession.
> > What I want to do is check the session on every page of the website.
> > 
> > Here is how Im doing it.
> > <xsp:logic>
> > if (session == null) {
> >     response.sendRedirect("loginForm.html")
> > } else {
> >     // execute XML 
> > }
> > </xsp:logic>
> > 
> > Id like somehow to put this in a style sheet so I wont have 
> > to add this code
> > to every page.
> > Any thoughts would be greatly appreciated.
> > 
> > Thanks
> > 
> > 
> > Anthony Diodato
> > Webmaster - IT
> > Prophet 21, Inc.
> > 19 West College Avenue
> > Yardley, PA 19067
> > 1-800-776-7438, ext. 4600
> > Fax: 215-321-8014 
> > [EMAIL PROTECTED]
> > http://www.p21.com/
> > Prophet 21 -- Powering the Distribution Industry for the 
> Digital Age 
> > 
> > For the latest press releases from Prophet 21 --
> > http://www.p21.com/press/press.html 
> > *   2/12/2001 - Trading Partner Connect Offers 
> > Enterprise-to-Enterprise
> > (E2E) Commerce 
> > *   2/9/2001 -- Prophet 21 CommerceCenter 8.0 is Now Available
> > *   2/9/2001 -- Prophet 21 Upgrades and Enhances Prophet 21 Acclaim
> > For the latest articles on Prophet 21
> > http://www.manufacturing.net/magazine/id/archives/2001/ind010.
> 02/techupdate.
> htm 
> http://www.manufacturing.net/magazine/id/develop/techmain01.1.htm 
> http://www.manufacturing.net/magazine/id/archives/2000/ind1201
/news.htm




Visit our website at http://www.p21.com/visit 
The information in this e-mail is confidential and may contain legally
privileged information.  It is intended solely for the person or entity to
which it is addressed.  Access to this e-mail by anyone else is
unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution, action taken, or action omitted to be taken in
reliance on it, is prohibited and may be unlawful.  If you received this
e-mail in error, please contact the sender and delete the material from any
computer. 



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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

This message may contain privileged and/or confidential information.  If you
have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate or distribute it; do not open any
attachments, delete it immediately from your system and notify the sender
promptly by e-mail that you have done so.  Thank you.

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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


Visit our website at http://www.p21.com/visit 
The information in this e-mail is confidential and may contain legally
privileged information.  It is intended solely for the person or entity to
which it is addressed.  Access to this e-mail by anyone else is
unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution, action taken, or action omitted to be taken in
reliance on it, is prohibited and may be unlawful.  If you received this
e-mail in error, please contact the sender and delete the material from any
computer. 



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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

This message may contain privileged and/or confidential information.  If you
have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate or distribute it; do not open any
attachments, delete it immediately from your system and notify the sender
promptly by e-mail that you have done so.  Thank you.

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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


Visit our website at http://www.p21.com/visit 
The information in this e-mail is confidential and may contain legally
privileged information.  It is intended solely for the person or entity to
which it is addressed.  Access to this e-mail by anyone else is
unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution, action taken, or action omitted to be taken in
reliance on it, is prohibited and may be unlawful.  If you received this
e-mail in error, please contact the sender and delete the material from any
computer. 



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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

Reply via email to