Re: newbie xsp question
I don't know why the simple.xsp was done the way it was but I believe you should also be able to write it this way: xsp:logic for (int i=0; i lt; 3; i++) { liItem xsp:expri/xsp:expr/li } /xsp:logic I think wrapping it in CDATA sections is just to make it possible to use the in the for statement I-Lin Kuo wrote: In the sample xsp provided with cocoon, on the page docs/samples/xsp/simple.xsp There's a section of code that looks like this: xsp:logic ![CDATA[ for (int i=0; i3; i++) {]]![CDATA[ ]] li Item xsp:expri/xsp:expr /li ![CDATA[ } ]]![CDATA[ ]] /xsp:logic I understand that the CDATA sections are needed to escape the in the for loop declaration, but it seems to me that only one such is needed. To test this, I made up another page with the following: ul xsp:logic ![CDATA[ for (int j=0;j3;j++) ]]{ liItem xsp:exprj/xsp:expr/li } /xsp:logic /ul This worked, and confirmed my suspicions. So my question is, why were there so many CDATA sections in the original, and when am I supposed to use them? Also, I'd appreciate it if someone could explain what xsp:content is supposed to do, or refer me to some place in the documentation where all the tags are listed (I couldn't find any). _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SV: Re: Newbie XSP question - why dosn't this work?
Please let me know if some more info can help you guys help me, and I will include it ASAP. I really need some help here you see :) I... What... But... Ok tjeck this one out (this will probably not make any sence to people new to this thread): I have my old Java object that returns XML to my logicsheet. This object can return a lot of different XML, depending on what parameters it get (my super duper framework - joke). Now I have two different XML outputs on two different URL's. Each work just fine, C2 processes my XML just fine. But if I hit XML1-URL C2 processes the XML, and if I then hit XML2-URL reight thereafter it prints out the XML (my old problem returns), and I have to restart C2 to get XML2-URL to work correctly. And vise versa if I start by hitting XML2-URL (after a restart) it works but then XML1-URL fails (yes the old XML-printout problem again again). Are you confused, I know I am. I dont understand a thing at all Any input apriciated. Best regards Søren -Oprindelig meddelelse- Fra: David Rosenstrauch [mailto:[EMAIL PROTECTED]] Sendt: 6. november 2001 08:24 Til: [EMAIL PROTECTED] Emne: Fwd: Re: Newbie XSP question - why dosn't this work? Søren, OK. Problem solved. Frank was right. util:include-expr is the way to go. It will parse the text that you pass in to it, and generate SAX calls from it (as opposed to writing the text straight to the output - after escaping all the control chars - like it's doing now). I've attached: * test.xsp, which is the solution to your problem but using test data (you should be able to easily adapt it to your needs), and * test.xml, which is the output that proves this works. Note: 1) You must include the namespace xmlns:util=http://apache.org/xsp/util/2.0; in your XSP or the util:include-expr won't get called properly. 2) the super-nested call you need to make this work: util:include-exprutil:exprxsp:exprs/xsp:expr/util:expr/util:inclu de-expr xsp:exprs/xsp:expr takes the value of String s, which is then passed in to util:include-expr. This should solve your problem. Email if not. DR From: Frank Taffelt [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Newbie XSP question - why dosn't this work? Date: Tue, 6 Nov 2001 10:17:03 +0100 sorry i sent you the right in the wrong syntax. the code to embed your String is: util:include-exprutil:exprmsg/util:expr /util:include-expr alternatively you can let your ContactBO return either an * org.w3c.dom.Node that represents your BO in a DOM * object that implements org.apache.cocoon.xml.XMLizable for generating SAX-Events according to your BO-Data hth, frank - 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] - 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]
SV: Re: Newbie XSP question - why dosn't this work?
I... What... But... Ok tjeck this one out (this will probably not make any sence to people new to this thread): I have my old Java object that returns XML to my logicsheet. This object can return a lot of different XML, depending on what parameters it get (my super duper framework - joke). Now I have two different XML outputs on two different URL's. Each work just fine, C2 processes my XML just fine. But if I hit XML1-URL C2 processes the XML, and if I then hit XML2-URL reight thereafter it prints out the XML (my old problem returns), and I have to restart C2 to get XML2-URL to work correctly. And vise versa if I start by hitting XML2-URL (after a restart) it works but then XML1-URL fails (yes the old XML-printout problem again again). Are you confused, I know I am. I dont understand a thing at all Any input apriciated. Best regards Søren -Oprindelig meddelelse- Fra: David Rosenstrauch [mailto:[EMAIL PROTECTED]] Sendt: 6. november 2001 08:24 Til: [EMAIL PROTECTED] Emne: Fwd: Re: Newbie XSP question - why dosn't this work? Søren, OK. Problem solved. Frank was right. util:include-expr is the way to go. It will parse the text that you pass in to it, and generate SAX calls from it (as opposed to writing the text straight to the output - after escaping all the control chars - like it's doing now). I've attached: * test.xsp, which is the solution to your problem but using test data (you should be able to easily adapt it to your needs), and * test.xml, which is the output that proves this works. Note: 1) You must include the namespace xmlns:util=http://apache.org/xsp/util/2.0; in your XSP or the util:include-expr won't get called properly. 2) the super-nested call you need to make this work: util:include-exprutil:exprxsp:exprs/xsp:expr/util:expr/util:inclu de-expr xsp:exprs/xsp:expr takes the value of String s, which is then passed in to util:include-expr. This should solve your problem. Email if not. DR From: Frank Taffelt [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Newbie XSP question - why dosn't this work? Date: Tue, 6 Nov 2001 10:17:03 +0100 sorry i sent you the right in the wrong syntax. the code to embed your String is: util:include-exprutil:exprmsg/util:expr /util:include-expr alternatively you can let your ContactBO return either an * org.w3c.dom.Node that represents your BO in a DOM * object that implements org.apache.cocoon.xml.XMLizable for generating SAX-Events according to your BO-Data hth, frank - 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] - 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]
Re: Newbie XSP question - why dosn't this work?
I think either of these will work: xsp:logic![CDATA[ String msg = ContactBO.getContacts(xsl:value-of select=pim:nummer/); ]]/xsp:logic or xsp:logic String msg = ContactBO.getContacts(lt;xsl:value-of select=pim:nummer/gt;); /xsp:logic If not, I'll try to come up with another solution. DR At 02:24 PM 11/2/01 -0800, you wrote: Long time I had time to look at this, but I still have the problem. My problem is not getting the parameter to the Java method, but the fact that the XML returned from my method (msg) is escaped/encoded so that , and so on is escaped to something quite useless. I have attached my original post! Please help me :) -Oprindelig meddelelse- Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sendt: 12. oktober 2001 04:41 Til: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Emne: Re: SV: Newbie XSP question - why dosn't this work? Hi Søren, On Fri, 12 Oct 2001, Søren Neigaard wrote: xsp:logic String msg = ContactBO.getContacts( xsl:value-of select=pim:nummer/ !-- osv, hvis der er andre parametre -- ); System.out.println(\n--- XML returned from BO:\n); System.out.println(msg); System.out.println(\n---\n); /xsp:logic Are you sure you want to what you are doing with the -s? I am a complete newbie on this, but it seems to me that the Java part of things would get into problems with the 4 -s up there... you'd have to do some escaping of them, ie. String msg = ContactBO.getContacts( xsl:value-of select=\pim:nummer\/ ); Hope that works... Sincerely, Jan -- Mr. Jan-Aage Bruvoll IT Project Manager 20 Min Holding, Thurgauerstrasse 40, CH-8050 Zurich Zurich office: +41 1 307 4293, fax: +41 1 307 4281 Office/fax: +44 2072408283 Mobile: +44 7740291600 - 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] - 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] - 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]