cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt MacDougall" <m...@goodfoodpro.com>
Subject RE: displaying values in a browser from <xsp:logic>
Date Mon, 30 Sep 2002 19:47:14 GMT
Here's the full xsl page (minus a little html to save space).  I've attached
the full report.xml file as well in case it is needed ... thanks again for
the help, this stuff was dumped in my lap and I'm obviously a newbie ;-)

-Matt

html.xsl
##############

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xsp-request="http://apache.org/xsp/request/2.0"
	xmlns:xsp="http://www.apache.org/1999/XSP/Core">

<xsl:import href="html-common.xsl"/>

	<!-- The default templates in "html-common.xsl" may be overridden
	     by copying <template> elements from that file into this one,
		 and then modifying the HTML content of the copy. The page
		 element template is already pasted here as an example.
	-->


	<xsl:template match="page">

		<html>
		<head>
		<title><xsl:value-of select="/page/report/@name"/></title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<link rel="stylesheet" type="text/css" href="/admin/css/global.css" />
		</head>

		<body bgcolor="#99CCCC" topmargin="0" leftmargin="10" rightmargin="10"
bottommargin="0" marginheight="0" marginwidth="0">
		<!-- body table -->
		<table width="730" bgcolor="669999" border="0" cellpadding="0"
cellspacing="0">
		<tr>
		<td class="black_copy"><b><i>Your search returned <xsl:value-of
select="/page/results/totals/@rowcount"/> results:</i></b></td>
		</tr>
		<xsl:apply-templates select="results"/>
		Prevresult: <xsl:value-of select="prevresult"/>
		Nextresult: <xsl:value-of select="nextresult"/>
		</body>
		</html>
	</xsl:template>


	<xsl:template match="results">
		<xsl:for-each select="table/row">
			<xsl:variable name="row" select="."/>
			<!-- spacer row -->
			<tr><td><img src="/admin/images/spacer.gif" width="15" height="15"
/></td></tr>
			<tr>
			<td>
			<!-- search result table -->
			<table border="0" width="100%" cellpadding="0" cellspacing="0">
			<tr>
			<td valign="top" width="160">
			<img
src="/servlets/FlexImage?f=/admin/uploads/{$row/col[@field='web_photo_xml']/
photo/@src}&amp;a=resize&amp;w=160&amp;h=113" width="160" height="113"/>
			<br />
			<div align="center" class="green_link"><b><a
href="/admin/webadmin/right.php?show_item[0]=view+item&amp;pagoda_id[0]={$ro
w/col[@field='pagoda_id']/text()}" class="green_link">details</a> |
			<a href="results_wish_list.html" class="green_link">add to wish
list</a></b></div>
			</td>
			<!-- spacer -->
			<td><img src="/admin/images/spacer.gif" alt="" width="8" height="8"
/></td>
			<td valign="top">
			<table border="0" width="100%" cellpadding="2" cellspacing="1">
				<xsl:for-each select="/page/report/field-order/ordered-field">
					<xsl:variable name="ofid" select="@id"/>
					<xsl:variable name="field"
select="/page/report/fields/field[@id=$ofid]"/>
					<tr>
						<td width="100" bgcolor="#7EB1B1" class="black_copy"><xsl:value-of
select="$field/@title"/></td>
						<td bgcolor="#7EB1B1" class="white_copy"><xsl:apply-templates
select="$row/col[@field=$ofid]/node()"/></td>
					</tr>
				</xsl:for-each>
			</table>
			<!-- end search result data table -->
			</td>
			<!-- spacer -->
			<td><img src="/admin/images/spacer.gif" alt="" width="5" height="5"
/></td>
			</tr>

			</table>
			<!-- end search result table -->

		</td>
			</tr>
		</xsl:for-each>

</xsl:template>

</xsl:stylesheet>

-----Original Message-----
From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
Sent: Monday, September 30, 2002 1:58 PM
To: cocoon-users@xml.apache.org
Subject: Re: displaying values in a browser from <xsp:logic>


Matt MacDougall wrote:

>Vadim,
>
>Thanks for the help.  You're right, there is no <xsp:value-of>, I meant
><xsl:value-of>.
>

Where / how you are using XSL? All I see is XSP page. What's your sitemap?


>Right now I have report.xml which is called through the url like
>domain.com/report.xml?id=100.  This file includes report.xsl which chooses
a
>stylesheet based in the value of /page/report/@output.  For now I'm just
>working with <xsl:when
>test="/page/report/@output='html'">xsl/html.xsl</xsl:when>
>

How this XSL is coming into the picture?

Vadim



>html.xsl contains:
>
>Prevresult: <xsl:value-of select="prevresult"/>
>Nextresult: <xsl:value-of select="nextresult"/>
>
>According to all the documentation I have, this xsl:value-of tag should
grab
>the value of the <prevresult> and <nextresult> tags I have defined in
>report.xml like:
>
>###############################
>          <search-form>
>            <xsp:attribute
>name="searchtype"><xsp:expr>re.getAttribute("searchtype")</xsp:expr></xsp:a
t
>tribute>
>            <xsp:logic>
>              generateSearchForm(request, document, re,
>(Element)xspCurrentNode);
>            </xsp:logic>
>          </search-form>
>        }
>
>      </xsp:logic>
>
>    </esql:connection>
>
>	<xsp:logic>
>		String next_move_string = "1";
>		String prev_move_string = "-1";
>
>		String uri = request.getRequestURI();
>
>		<xsp-request:set-paramter
>name="move">next_move_string</xsp-request:set-paramter>;
>		String nextquery = request.getQueryString();
>
>		<xsp-request:set-paramter
>name="move">prev_move_string</xsp-request:set-paramter>;
>		String prevquery = request.getQueryString();
>
>//		String nexturl = uri + nextquery;
>//		String prevurl = uri + prevquery;
>		String nexturl = "Next";
>// just for testing
>		String prevurl = "Prev";
>// just for testing
>  </xsp:logic>
>
>  <prevresult>
>    <xsp:expr>prevurl</xsp:expr>
>  </prevresult>
>  <nextresult>
>    <xsp:expr>nexturl</xsp:expr>
>  </nextresult>
>
>
>  </page>
>
></xsp:page>
>###############################
>
>In this report.xml file I have one <xsp:page> block, one <page> block,
>several <xsp:logic> blocks and one <esql:connection> block.  As you can see
>from the above snippet, I have placed this particular <xsp:logic> block
>outside of the <esql:connection> but inside both page blocks.  Since
>report.xml does not directly include html.xsl but rather has report.xsl
call
>it as a stylesheet, could this be the problem?  Do I need to place this
>somewhere else is the pipeline?
>
>Again, thanks for the help.  Please let me know if I can explain this
>further.
>
>-Matt MacDougall
>
>
>
>-----Original Message-----
>From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
>Sent: Monday, September 30, 2002 8:24 AM
>To: cocoon-users@xml.apache.org
>Subject: Re: displaying values in a browser from <xsp:logic>
>
>
>Matt MacDougall wrote:
>
>
>
>>Hello,
>>
>>I'm having a problem getting the results of a Java function wrapped in
>><xsp:logic> tags to display on my page.  All I would like to do is display
>>the value of the variables prevurl and nexturl on the page.  This code
>>
>>
>below
>
>
>>is in an xsl file outside of the main template.  I'm calling this template
>>within my main one with <xsl:apply-templates select="prevnext"/>
>>
>>I have the following in an xsl file:
>>
>><xsl:template match="prevnext">
>>
>>
>>
>
>Matt,
>
>Is this a logicsheet? How does relevant portions of your XSP file look
>like? How does pipeline look like?
>
>
>
>
>>	<xsp:logic>
>>		String next_move_string = "1";
>>		String prev_move_string = "-1";
>>
>>		String uri = request.getRequestURI();
>>
>>		<xsp-request:set-paramter
>>name="move">next_move_string</xsp-request:set-paramter>;
>>		String nextquery = request.getQueryString();
>>
>>		<xsp-request:set-paramter
>>name="move">prev_move_string</xsp-request:set-paramter>;
>>		String prevquery = request.getQueryString();
>>
>>		String nexturl = uri + nextquery;
>>		String prevurl = uri + prevquery;
>>		nexturl = "Next";
>>// just for testing
>>		prevurl = "Prev";
>>// just for testing
>> </xsp:logic>
>>   <xsp:expr>prevurl</xsp:expr>
>>   <xsp:expr>nexturl</xsp:expr>
>></xsl:template>
>>
>>
>>###################
>>
>>Shouldn't I be seeing the values between those <xsp:expr> tags?  This is
>>compiling fine but I only receive an empty output for the <prevresult> and
>><nextresult> tags.  I've tried several things including <xsp:value-of ...>
>>
>>
>>
>
>IIRC, there is no <xsp:value-of> tag exist.
>
>Vadim
>
>




---------------------------------------------------------------------
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>

Mime
View raw message