> Question: when using the aggregator, is it possible to
> specify an attribute as
> well as the name of the parent element, eg if I have:
>
>
> <map:match pattern="about">
>
>  <map:aggregate element="page">
>   <map:part src="cocoon:/info"/>
>   <map:part type="file" src="otherInfo.xml"/>
>  </map:aggregate>
>
>  <map:serialize/>
> </map:match>
>
> it will give me something like
>
> <page>
>  <info/>
>  <otherInfo/>
> </page>
>
> whereas I would like
>
> <page type="nicks_info_page">
>  <info/>
>  <otherInfo/>
> </page>
>
>
> Is this possible? I'm using cocoon 2.0.2

It seems not. But you could add the attribute AFTER aggregation, using an
XSL transform.

You sitemap would look like this:

 <map:match pattern="about">

  <map:aggregate element="page">
   <map:part src="cocoon:/info"/>
   <map:part type="file" src="otherInfo.xml"/>
  </map:aggregate>

  <!-- set the "type" attribute of the root "page" element -->
  <map:transform src="set-root-page-type.xsl">
   <map:parameter name="root-page-type" value="nicks_info_page"/>
  </map:transform>

  <map:serialize/>
 </map:match>

... and in the stylesheet (set-root-page-type.xsl) you would have:

...
<xsl:variable name="root-page-type"/>

<xsl:template match="/page">
        <page type="{$root-page-type}">
                <xsl:copy-of select="*"/>
        </page>
</xsl:template>

XSLT is your friend! ;-)

Con


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