Hy;

I'm also new to cocoon, but i think, your
problem can be solved directly using the
sitemap capabilities by merging the two xml files with
aggregation then applying a stylesheet on the merged
data...

But you also could do it directly within the xslt context:
You can use the document() function in your XSLT-file.
This function allows you to refer to data contained within
another XML-file. This is completely decoupled from cocoon
though. It's more about how to work with XSLT:

1.) From within the cocoon sitemap you would
create something like this within a pipeline:

<map:match pattern="projects.xml">
  <map:generate  src="/projects.xml"/>
  <map:transform type="xslt" src="mytransformer.xsl">
    <map:parameter name="viewfile" value="views.xsl"/>
  </map:transform>
  <map:serialize/>
</map:match>


2.) In the stylesheet you would then include a global parameter
outside of any template:

<xsl:param name="viewfile">standardviews.xml</xsl:param>

Note: the value "standardviews.xml" is taken, if you don't
apply the parameter as stated in 1.)


3.) Then finally you would refer to an element in the viewfile
via select attribute. e.g. if you would want to iterate through
your view elements:

<xsl:for-each select="document($viewfile)/views/view">
. . .
</xsl:for-each>

you can use this wherever you can apply a select attribute...


Hope, that helps getting further. Maybe there are better
solutions. Maybe the aggregation within a pipeline makes it
even simpler for you.

regards, hussayn

Kasper Nielsen wrote:
Just started using Cocoon and I have a rather simple question:

Lets say i have a document with all my data (projects.xml)
<projects>
    <project id="A1">
        <name> RailwayTrack DF</name>
        <responsible> kni </responsible>
        <economy_actual>123</economy_actual>
        <economy_estimate>456</economy_estimate>
        <schedule_estimate>789</economy_estimate>
    </project>
    <project id="B4">
        <name> Digital Transmission </name>
        <responsible> pjc </responsible>
        <economy_actual>987</economy_actual>
        <economy_estimate>654</economy_estimate>
        <schedule_estimate>321</economy_estimate>
    </project>
    ............
</projects>

And i also have a definition of some views of the data (views.xml)

<views>
    <view name="estimate">
        <columns>
            <measure name="schedule_estimate"/>
            <measure name="economy_estimate"/>
        </columns>
    </view>
    <view name="overview">
        <columns>
            <measure name="name"/>
            <measure name="responsible"/>
        </columns>
    </view>
</views>

Now I want to given the name of the view, lets say "estimate" to combine it
into another xml document, that is extract only the data mentioned in the
view, in this case it would be the "schedule_estimate" column and the
"economy_estimate" column
The resulting document should look something like this
<table>
    <columndefs>
        <columndef>
            <column-name>schedule_estimate</column-name>
        </columndef>
        <columndef>
            <column-name>economy_estimate</column-name>
        </columndef>
    </columndefs>
    <tabledata>
        <row>
            <entry>456</entry>
            <entry>789</entry>
        </row>
        <row>
            <entry>654</entry>
            <entry>321</entry>
        </row>
    </tabledata>
</table>

Can I "merge" 2 documents in that way with xslt?
Or do I need a custom transformer?

regards
  Kasper Nielsen


---------------------------------------------------------------------
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:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

--
Dr. Hussayn Dabbous
SAXESS Software Design GmbH
Neuenhöfer Allee 125
50935 Köln
Telefon: +49-221-56011-0
Fax:     +49-221-56011-20
E-Mail:  [EMAIL PROTECTED]


---------------------------------------------------------------------
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:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to