Solved

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

Posted on 2009-04-10
5
1,020 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

832 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