you must define a new taglib in cocoon.xconf file and use it in your xsp 
page, for example add to cocoon.xconf:

                <builtin-logicsheet>
                    <parameter name="prefix" value="ship"/>
                    <parameter name="uri" 
value="http://sample.com/xsp/ship/1.0"/>
                    <parameter name="href" 
value="context://stylesheets/ship.xsl"/>
                </builtin-logicsheet>

this will allow you to use the ship namespace in the xsp page in order 
to use the taglib defined in context://stylesheets/ship.xsl
ship.xsl (see attached file) defines two new tags that you can use 
inside your xsp page in order to retrieve a ship name using the ship code
    <ship:get-shipName>
        <ship:shipCode>SP</ship:shipCode>
    </ship:get-shipName>

for more help look at the taglibs documentation or you can use the 
SQLTransformer (I haven't used it yet)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:xsp="http://apache.org/xsp"; xmlns:esql="http://apache.org/cocoon/SQL/v2"; xmlns:ship="http://sample.com/xsp/ship/1.0";>
	<!-- Get ship Name -->
	<xsl:template match="ship:get-shipName">
		<esql:connection>
			<esql:pool>database</esql:pool>
			<esql:execute-query>
				<esql:query>SELECT * FROM SHIP WHERE CODE = <esql:parameter>
						<xsl:call-template name="get-nested-content">
							<xsl:with-param name="content" select="ship:shipCode"/>
						</xsl:call-template>
					</esql:parameter>
				</esql:query>
				<esql:results>
					<esql:row-results>
						<xsp:content>
							<esql:get-string column="NAME"/>
						</xsp:content>
					</esql:row-results>
				</esql:results>
			</esql:execute-query>
		</esql:connection>
	</xsl:template>
	<!-- Standard Templates -->
	<xsl:template name="get-nested-content">
		<xsl:param name="content"/>
		<xsl:choose>
			<xsl:when test="$content/*">
				<xsl:apply-templates select="$content/*"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$content"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
		<xsl:copy>
			<xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
		</xsl:copy>
	</xsl:template>
</xsl:stylesheet>

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