Hello!

In my xsp-page the following statemet works correctly:

 <cinclude:include src="cocoon:/SimpleTable.htm" element="xxx"/>
 
However I'm required to assign the value of src dynamically. 

Initially I tried this statement which did not work:

<cinclude:include
src="<xsp:expr>(String)((java.util.Map)request.getAttribute("restructComps")).get("uiSimple")"
 element="xxx"/>


Later I tried the following:
 
 <cinclude:include>
                  <xsl:attribute
name="src"><xsp:expr>(String)((java.util.Map)request.getAttribute("restructComps")).get("uiSimple")</xsp:expr></xsl:attribute>
                  <xsl:attribute name="element">xxx</xsl:attribute>
 </cinclude:include>
 
.. which did not work.

As a consequence I simplified the statemet above as follows:
 
 
 <cinclude:include>
                  <xsl:attribute
name="src">cocoon:/SimpleTable.htm</xsl:attribute>
                   <xsl:attribute name="element">hari</xsl:attribute>
 </cinclude:include>
 


Investigating the resulting exception I found out that apparently cocoon
tries to perform the cinclude without any parameters. This results in a
NullPointerException. At the time if xsl attribute makes available the attributes src
and element it's already too late for cinclude.


Anybody a better idea how to dynamically set up a cinclude element?

Regards, Harald



Attachment: Exceptions and compiled XSP:

...
java.lang.NullPointerException
        at
org.apache.cocoon.transformation.CIncludeTransformer.processCIncludeElement(CIncludeTransformer.java:138)
        at
org.apache.cocoon.transformation.CIncludeTransformer.startElement(CIncludeTransformer.java:83)
        at
org.apache.cocoon.www.WebSimpleMain_htm_xsp_xsl.generate(WebSimpleMain_htm_xsp_xsl.java:242)
        at
org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGenerator.java:226)
...
        

abc_XSP.java:

...

this.contentHandler.startElement("http://apache.org/cocoon/include/1.0";,
                                     "include", "cinclude:include",
xspAttr);

    xspAttr.clear();


    this.characters("\n                  ");

    xspAttr.addAttribute("", "name", "name", "CDATA", "src");


    this.contentHandler.startElement("http://www.w3.org/1999/XSL/Transform";,
                                     "attribute", "xsl:attribute", xspAttr);

    xspAttr.clear();


    this.characters("cocoon:/SimpleTable.htm");


    this.contentHandler.endElement("http://www.w3.org/1999/XSL/Transform";,
                                   "attribute", "xsl:attribute");


    this.characters("\n                   ");

    xspAttr.addAttribute("", "name", "name", "CDATA", "element");


    this.contentHandler.startElement("http://www.w3.org/1999/XSL/Transform";,
                                     "attribute", "xsl:attribute", xspAttr);

    xspAttr.clear();


    this.characters("xxx");


    this.contentHandler.endElement("http://www.w3.org/1999/XSL/Transform";,
                                   "attribute", "xsl:attribute");
 ...

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


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

Reply via email to