Solved

trying to use tinymce with xslt.. Has anyone done this?  I'm having problems

Posted on 2009-04-10
5
1,041 Views
Last Modified: 2013-11-18
I currently have an xml file that references a stylesheet.  This stylesheet generates an html file based on the xml document that's referencing it.  What I want to do is make the xsl stylesheet display an editor that is initially populated with the data from the corresponding xml file.   The editor I'm trying to embed into my html is an open source tool called tinyMCE, which is downloadable from http://tinymce.moxiecode.com/download.php

Now, to test out my stylesheet, I open up the corresponding xml file from a web browser, currently using firefox.  For whatever reason, I'm getting "tinyMCE not defined in the xml file" error in my browser when opening the xml file.  Now there isn't any html code in the xml, the html code is generated within the corresponding spreadsheet..

So my xml file looks something like this
 <?xml-stylesheet type="text/xsl" href="mystylesheet.xsl"?>
    <elmt1> ... </elmnt1>
    :
   
My stylehseet looks like this
<xsl:stylesheet versino="1.0 xmlns="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" encoding="UTF-*" version="1.0" />
     <xsl:template match="elmnt1">
         <html>
        <head>
        <title>TinyMCE Test</title>
        <script language="javascript" type="text/javascript" src="file://C:/tinyMCE/jscripts/tiny_mce/tiny_mce.js"></script>
        <script language="javascript" type="text/javascript">
                tinyMCE.init((
                      mode : "textareas"
               ));
        </script>
        </head>
        <body>
        <form method="post">
             <textarea name="content" cols="50" rows="15">This is some content that will be editable by TinyMCE.
             </textarea>
        </form>
       </body>
       </html>
    </xsl:template>
</xsl:stylesheet>

Anybody have a clue?  If I pull the html above out of the xslt file and put it into a plain ole html file, it works fine.  But from the xsl file the browser just locks up.  The only way I know there are errors is because I am using firebugs.  Its telling me that the tinyMCE object is undefined.  

Any Clue?
0
Comment
Question by:adessell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 11

Accepted Solution

by:
CraigYellick earned 125 total points
ID: 24122714
I didn't try installing TinyMCE but I did try parsing and applying the stylesheet. If that is literally the XSLT you are using it has some problems with the xsl:stylesheet line. Below is the version that I tested and it generated an HTML just fine.
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
<xsl:output method="html" indent="yes" encoding="UTF-*" version="1.0" />
 
 <xsl:template match="elmnt1">
        <html>
        <head>
        <title>TinyMCE Test</title>
        <script language="javascript" type="text/javascript"
              src="file://C:/tinyMCE/jscripts/tiny_mce/tiny_mce.js"></script>
        <script language="javascript" type="text/javascript">
                tinyMCE.init((
                      mode : "textareas"
               ));
        </script>
        </head>
        <body>
        <form method="post">
             <textarea name="content" cols="50" rows="15">
                This is some content that will be editable by TinyMCE.
             </textarea>
        </form> 
       </body>
       </html>
    </xsl:template>
 
</xsl:stylesheet>

Open in new window

0
 
LVL 39

Expert Comment

by:abel
ID: 24125987
@OP: note that the output encoding is set to "UTF-*". This is not a known encoding and might give problems. Try "UTF-8" or "UTF-16" instead (together with the changes of CraigYellick of course).
0
 

Author Comment

by:adessell
ID: 24170459
the xsl seems to work fine in IE.  It doesn't work in firefox.  Has anyone tried doing this in firefox?
0
 

Author Comment

by:adessell
ID: 24170477
More specifically in firefox the tinymce edit window pops up as a plain ole text box.  But it shouldn't be just a text box.  IT should be a text box with some edit buttons included, such as underline, italics, etc..  LIke a mini word perfect window.
0
 
LVL 39

Expert Comment

by:abel
ID: 24170537
That shouldn't have anything to do with the XML or the XSLT, provided you make sure that the output you generate is either run through a post-processor like Prototype or JScript (iirc) to run the javascript that is embedded in the result, or is run on the server.

To execute javascript that is a result of client side transformations you just need to go that little extra length. And these libraries have already done that for you.

If you also have problems with tinymce when you do not involve XML or XSLT, then you should try the solution offered on this page: http://community.contractwebdevelopment.com/firefox-wont-work-with-fckeditor-or-tinymce

-- Abel --
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question