You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by William Bagby <wi...@adone.com> on 2001/03/28 18:29:31 UTC

How is XSP Processing done?

According to the Cocoon XSP page (http://xml.apache.org/cocoon/xsp.html):

"The order in which xmlns: attributes appear dictates library processing
order. The XSP built-in library, though, is always applied last, regardless
of its position in the xmlns: attribute list."

Does this mean I can do something like this:

test.xml
-----------------------------------------------------------
<xsp:page language="java"
	xmlns:xsp="http://www.apache.org/1999/XSP/Core"
	xmlns:util="http://www.apache.org/1999/XSP/Util"
	xmlns:myutil="http://www.mydomain.com/XSPTagLib/Myutil"
	version="1.0"
>

<page>
	<pagecount><util:counter/><pagecount>
	<header>You have accessed this page <myutil:get-count/>
times</header>
</page

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

myutil.xsl
------------------------------------------------------------
...
<xsl:template match="myutil:get-count">
	<xsp:logic>
	int count = Integer.parseInt( "<xsl:value-of select="//pagecount"/>"
);
   	switch ( count ) {
		case 1: <xsp:content>one</xsp:content>; break;
		case 2: <xsp:content>two</xsp:content>; break;
		case 3: <xsp:content>three</xsp:content>; break;
		default : <xsp:content>many</xsp:content>; break;
	}
	</xsp:logic>
</xsl:template>
---------------------------------------------------------------

Please forgive my syntax if it is wrong, and no, this is not a very
practical example...but I think you get the point.

If this CANNOT be done, is there some way to access nodes from within the
same XSP?  Or does this have to be done programmatically?  Or am I not
making sense?

Thanks,

William.

	


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>