Hi,

Our solution is as below, maybe it will give you some idea. But we don't use XSP.

In the form a simple javascript is used to pass the context as cdata section. wrapped 
inside an element named "staticDesign".

  <xsl:template match="staticDesign">
      <form name="dummyForm">
          <textarea rows="25" wrap="off" name="inputArea" style="font-family: courier 
new; width: 90%;">
            <xsl:value-of disable-output-escaping="yes" select="text()"/>
          </textarea>
      </form>
      <form action="yourAction" name="staticDesign" method="post"
            
onsubmit="this.designContent.value='&lt;staticDesign&gt;&lt;![CDATA['+document.dummyForm.inputArea.value+']]&gt;&lt;/staticDesign&gt;';">
      <input type="hidden" name="designContent"/>
      <input type="submit" name="submit" value="Save"/>
      </form>
  </xsl:template>

In the sitemap, we use the Stream generator to take the single input (designContent) 
as the generated xml, them we use SourceWriting Transformer to write the xml into a 
file

        <map:match pattern="sav*/**">
          <map:generate type="stream">
            <map:parameter name="form-name" value="designContent"/>
          </map:generate>
                 <!-- Wrap the "staticDesign" inside SourceWriting elements for the 
next step
          <map:transform src="write.xsl">
            <map:parameter name="filename" value="{request-param:cms-file_name}"/>
          </map:transform>
          <map:transform type="write-source">
            <!-- have to use a special xml serializer so that staticDesign elements 
are treated
              as cdata section-->
            <map:parameter name="serializer" value="scxml"/>
          </map:transform>
          <map:serialize type="html"/>
        </map:match>

The fact is, we wrap the content as a CDATA section inside a single "staticDesign" 
element. In this way the <> are preserved. When putting it into the form, the 
disable-output-escaping="yes" attribute prevent it from becoming &gt&lt.

One last point to make this work is that a special xml serializer must be used for the 
SourceWriting Transformer.

    <map:serializer logger="sitemap.serializer.scxml" mime-type="text/xml" 
name="scxml" src="org.apache.cocoon.serialization.XMLSerializer">
      <cdata-section-elements>staticDesign</cdata-section-elements>
    </map:serializer>

Sorry for such a long post, I understand that our usage may not be the way you want to 
work with it. But just thought it might give you some ideas to work on.

Cheers,
Edison

On Fri, 5 Dec 2003 15:41:35 -0500, Brent L Johnson wrote:
>Yeah this is quite annoying because as soon as I do an <xsl:value-of
>value="$myrequestparam"/>
>
>That produces an encoded string value that gets passed all the way to the
>actual writing of the file.. so it gets overwritten with &lt; and &gt;
>
>- Brent


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

Reply via email to