Solved

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

Posted on 2009-04-10
5
999 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Mongodb hierarchy 2 34
XML error 2 41
Microsoft Edge 9 81
Word files to Wordpress Posts 2 26
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now