You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christian Parpart <cp...@t-online.de> on 2001/01/08 01:23:53 UTC
How to use Taglibs in taglibs
Hi
I've tried to create a taglib wich uses the esql taglib.
But it doesnt work in my way. What do I need?
If I do call my template <taglib:get-all/> he only displays
the internal data like esql:driver and esql:dburl and so on.
If I put the code directly into my xml file it works fine.
But how can I put it into my xsl-taglib?
This is my taglib.xsl included into my
file.xml via <?xml-logicsheet href="taglib.xsl"?>
[--------------------------------------
<?xml version="1.0"?>
<!-- TagLib: taglib.xsl -->
<xsl:stylesheet
xmlns:xsp="http://www.apache.org/1999/XSP/Core"
xmlns:request="http://www.apache.org/1999/XSP/Request"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:taglib="http://www.surakware.com/Layout/Taglibs/taglib"
xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
>
<xsl:template match="xsp:page">
<xsp:page>
<xsl:apply-templates select="@*"/>
<xsp:logic>
// any initial java code
</xsp:logic>
<xsl:apply-templates/>
</xsp:page>
</xsl:template>
<xsl:template match="taglib:get-all">
<esql:connection>
<esql:driver><xsl:value-of select="taglib:driver"/></esql:driver>
<esql:dburl><xsl:value-of select="taglib:dburl"/></esql:dburl>
<esql:username><xsl:value-of
select="taglib:username"/></esql:username>
<esql:password><xsl:value-of
select="taglib:password"/></esql:password>
<esql:execute-query>
<esql:query>
SELECT
Concat(DayOfMonth(Date), '.',
Month(Date), '.',
Year(Date)) as PrintDate,
Concat(Hour(Date), ' Uhr ', Minute(Date), ' Minuten') as Time,
Date,
Title,
Author,
AuthorEMail,
Text,
ID, ParentID
FROM <xsl:value-of select="taglib:from"/>
ORDER BY Date DESC
<xsl:if test="taglib:limit">
LIMIT <xsl:value-of select="taglib:limit"/>
</xsl:if>
</esql:query>
<esql:results>
<esql:row-results>
<!-- ... -->
<esql:row-results>
</esql:results>
</esql:execute-query>
</esql:connection>
</xsl:template>
<xsl:template match="@*|node()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
--------------------------------------]
Thanks in advance,
Christian Parpart
SurakWare
cparpart@surakware.com
http://www.surakware.com