You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Chris Gow <cg...@digitalfairway.com> on 2001/01/19 02:51:40 UTC

Saving nodes in XSP

Hi All:

Another weird question for the list.  How can I save the value of a node 
(and its children) in my XSP page to optionally be added later?

What I want to do is something like this:

(XML file fragment)

<xsp:page>
  <page>
<myns:fragment-to-save id="1">
   <message>
      I want the message tag to be saved/copied as a Node object
      in my .java file
   </message>
</myns:fragment-to-save>
...
</page>
</xsp:page>

(XSP fragment)

<xsl:template match="myns:fragment-to-save">
   <xsp:logic>
     <!-- assume that fragments is a Map that has previously been created -->
     __fragments.put( "<xsl:value-of select="@id"/>", <!--What do I put 
here to add the Node representation of <message> in my Hashmap? --> );
   </xsp:logic>
</xsl:template>

I tried cloning xspCurrentNode and adding that to the hashmap but that only 
contained what has been previously processed (in the case above just the 
tag <page>).

Is this possible?

Is there a better approach?


Thanks

Chris