[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2009-04-10
5
Medium Priority
?
1,080 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:
Craig Yellick earned 250 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

830 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