On Thu, Jul 19, 2001 at 08:09:09AM +0200, [EMAIL PROTECTED] wrote:
> In my xsl-file I have written:
> 
> <xsl:for-each select="state">
> 
>       <xsl:text disable-output-escaping="yes">
> 
>       <![CDATA[
> 
>               function start(frm){
> 
>                       initialize(']]>
> 
>       </xsl:text>
> 
>       <xsl:value-of select="@id"/>
> 
>       <xsl:text disable-output-escaping="yes">
> 
>       <![CDATA[', "]]>
> 
>       </xsl:text>
> 
>       <xsl:apply-templates/>
> 
>       <xsl:text disable-output-escaping="yes">
> 
>       <![CDATA[");
> 
>               output(frm, 'init');
> 
>       }]]>
> 
>       </xsl:text>
> 
> </xsl:for-each>
> 
> This is a javascript-function, which takes a string as a
> parameter. My problem is that Cocoon parses this as a string with
> linebreaks, which Javascript doesn't accept.
> 
> The output is like this:
> 
>       function start(frm){
> 
>               initialize('
> 
>                       init
> 
>                               ', "
> 
> 
> 
>               Text
> 
>                               ");
> 
>                                       output(frm, 'init');
> 
>                               }
> 
> How can I get Cocoon to not add any line breaks?
> 
> I have been looking for an answer to this on the web, but I can't find 
> anything. I did read about changing the following line in
> cocoon.properties though:
> 
> formatter.text/html/loose.line-width = 120
> 
> But, I can't find this file on my hard disk. Does it even exist for
> Cocoon 2?

I'm a relative Cocoon/XSL newbie, but if I'm not mistaken the xsl:text
node specifically serves the purpose of saving linebreaks, including
the ones you have in your source file. Try changing your code to read
something like:

        <xsl:text disable-output-escaping="yes">
        <![CDATA[
                function start(frm){
                        initialize(']]></xsl:text>

Note that there is no linebreak between the end of the CDATA and the
end of the xsl:text node. You'd need to repeat this for all the
elements you're inserting...

Good luck!

-- 

----------------------------------------------------------------------
 Paul Paradise                                        Office: AE-209U
 Engineering Intern                      Email: [EMAIL PROTECTED]
 Corporate IT R&D                                   Tel: 858.651.5883
 Qualcomm Incorporated
----------------------------------------------------------------------

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