On 01.10.2008, at 15:09, nanomonk wrote:


generally, we have somethink like that:

<?xml version="1.0" encoding="UTF-8"?>
<root>
 <abra>
   <abrakadabra>blah<abrakadabra>
   <abrakadabra2>blah2<abrakadabra2>
</abra>
</root>

there is need to put to this xml some elements filled with data that we got
from database.
xsp is too simple for that. but... but 2.2...
result have to be like this:

<?xml version="1.0" encoding="UTF-8"?>
<root>
 <abra>
   <abrakadabra>blah<abrakadabra>
   <abrakadabra2>blah2<abrakadabra2>
</abra>
<block id="1">
<foo>
   <boo>blah<boo>
   <boo2>blah2<boo2>
</foo>
....
<foo>
   <boo>blah<boo>
   <boo2>blah2<boo2>
</foo>
</block>

<block id="2">
<foo>
   <boo>blah<boo>
   <boo2>blah2<boo2>
</foo>
....
<foo>
   <boo>blah<boo>
   <boo2>blah2<boo2>
</foo>
</block>
</root>

I'm really hope that there is no need to use xslt:( why we just can't to
create DOM Document in some bean and response it to client?

To me this looks like a good use case for the include transformer [1] & [2]:

input.xml:
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:i="http://apache.org/cocoon/include/1.0";>
        <abra>
                <abrakadabra>blah</abrakadabra>
                <abrakadabra2>blah2</abrakadabra2>
        </abra>
        <i:include src="cocoon:/fromDb/1"/>
        <i:include src="cocoon:/fromDb/2"/>
</root>

sitemap fragment:
<map:match pattern="">
        <map:generate src="input.xml"/>
        <map:transform type="include"/>
        <map:serialize type="xml"/>
</map:match>

<map:match pattern="fromDb/*">
        <!-- TODO read from database... -->
        <map:serialize type="xml/>
</map:match>

Alex

[1] http://cocoon.apache.org/2.2/core-modules/core/2.2/1048_1_1.html
[2] 
http://cocoon.apache.org/2.2/core-modules/core/2.2/apidocs/org/apache/cocoon/transformation/IncludeTransformer.html


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to