cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dirk Reiss" <d.re...@tu-bs.de>
Subject Re: Call of dynamically created tags in logicsheets
Date Wed, 13 Mar 2002 15:39:31 GMT
Hello again,

thank you very much, this works fine, but the next problem is, that several
files are not processed
recursively, which means: one file links to another which (for itself)
contains/links to another using the same tags
as the first one...
this means, that we would have to include these files "on-the-fly" and start
over parsing the included  content.

is this possible? as far as we understand, the serverpages-generator would
have to be called again after the
cinclude-transformer... is this right?

btw: we are using logicsheets and cocoon2.0

thanks for your quick answer
best regards,

dirk

----- Original Message -----
From: "Vadim Gritsenko" <vadim.gritsenko@verizon.net>
To: <cocoon-users@xml.apache.org>
Sent: Thursday, March 14, 2002 4:18 PM
Subject: RE: Call of dynamically created tags in logicsheets


Dirk & Torsten:

What I understood: You want to insert content of document using XSLT
document() function. Name of the document is generated dynamically by
XSP.

If this is right, what you have to do:

---------- sitemap -------------
<!-- apply 'ownnamespace' logicsheet to the x.xml,
     compile and execute server page -->
<map:generate type="serverpages" src="x.xml"/>
<!-- do include -->
<map:transform type="cinclude"/>

---------- logicsheet -------------
<xsl:template match="ownnamespace:link">
  <cinclude:include>
    <xsp:attribute name="src"><xsp:expr>getURI("<xsl:value-of
select="@identifier"/>")</xsp:expr></xsp:attribute>
  </cinclude:include>
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="ownnamespace:toInsert">
  <cinclude:include src="."/>
</xsl:template>



cinclude namespace should be declared as:
  xmlns:cinclude="http://apache.org/cocoon/include/1.0"

Take a look at aggregate.xsp and logicsheet.xsp, it might help.

Vadim

-----Original Message-----
From: Dirk Reiss [mailto:d.reiss@tu-bs.de]
Sent: Wednesday, March 13, 2002 7:18 AM
To: cocoon-users@xml.apache.org
Subject: Call of dynamically created tags in logicsheets

Hello,

we have the follogwing logicsheet where we dynamically create a tag with
the content of the return value of a java method. The creation of the
tag is working very well so that I did not included the Java-code in
this example. The output in the browser is currently a file having a tag

<ownnamespace:toInsert>Content</ownnamespace:toInsert>

We thought that an <apply-templates/> would cause Cocoon to apply the
template <ownnamespace:toInsert> being part of the logicsheet but it
does not work for us. Is this not possible within a logicsheet to create
dynamically tags because it was working during the later transformation
process. If it is possible, please let us know what we have to change.
If you need further information, please let us know so that we can
provide them.

Thanks,
Dirk

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsp="http://apache.org/xsp"
xmlns:ownnamespace="http://www.ownnamespace.org/xsl"
xmlns:xinclude="http://www.w3.org/2001/XInclude"
xmlns:util="http://apache.org/xsp/util/2.0"
>


<xsl:template match="ownnamespace:header">
<xsp:logic>

<!-- some Java code -->
</xsp:logic>

<xsl:apply-templates/>
</xsl:template>


<xsl:template match="ownnamespace:link">
<ownnamespace:toInsert>
<xsp:expr>getURI("<xsl:value-of
select="@identifier"/>")</xsp:expr>
</ownnamespace:toInsert>
<xsl:apply-templates/>
</xsl:template>


<xsl:template match="ownnamespace:toInsert">
<xsl:apply-templates select="document(.)" />
</xsl:template>

<xsl:template match="@*|node()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>


--------------

The xsp-page which is used to call the logicsheet looks as follows

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsp:page
language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:ownnamespace="http://www.ownnamespace.org/xsl"
xmlns:util="http://www.apache.org/1999/XSP/Util"
xmlns:xinclude="http://www.w3.org/2001/XInclude"
>
<ownnamespace:header/>

<page>
<ownnamespace:link identifier="IDENTIFIER"/>
</page>
</xsp:page>


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


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


Mime
View raw message