[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: CDATA or escape in the result tree problems

Subject: Re: CDATA or escape in the result tree problems
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 01 Nov 2006 00:02:27 +0100
escaping in tinymce
Kjetil Kjernsmo wrote:
The textarea element is in the default namespace of the stylesheet, I have not assigned any namespace to that.
you mean that your xpatch declaration is in the default namespace, your source document, or the textarea element in the source document? The xpath namespace must match the namespace of the textarea in the source document. Perhaps you can provide us with a smallest working example (with your error in it) with source/xslt/output?

The fragment I get from TinyMCE is asserted to be XHTML under some conditions I think I have met, but I have not actually seen a namespace on these elements either.

If there's no namespace attached in the source, then you can use it without namespace declarations in your XSLT.


I suspect "valid XHTML" ignores a few things, such as the namespace

If you mean what browsers do with it: indeed, they ignore the namespace declaration.


declaration. Also, TinyMCE gives me a whole document, but I manipulate the DOM in my application to only include children of the body.

But what is the part that eventually gets to the XSLT processor? A bunch of nodes surely must have a root node. Do you give the DOM to the XSLT processor? Does the DOM that you create have a namespace?


I tried to insert a xmlns:xhtml="http://www.w3.org/1999/xhtml" and xhtml:textarea, but it made no difference.

In the source, the xpath or the xslt root declaration? If this is your XHTML:
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>some title</title></head>
<body>
<form>
<textarea>Some data</textarea>
</form>
</body>
</html>


And this is your XSLT:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xhtml="http://www.w3.org/1999/xhtml">

<xsl:template match="/">
<xsl:apply-template select="xhtml:textarea" />
</xsl:template>
<xsl:template match="xhtml:textarea">
      <textarea>
               Do something with this node
      </textarea>
</xsl:template>

Then your output will look like this:
<textarea xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xhtml="http://www.w3.org/1999/xhtml">
   Do something with this node
</textarea>

Note that the output has no namespace attached for the textarea element. But the input document has and the XSLT document has (for the xhtml prefix, that is), and the XPath has.

Cheers,
-- Abel Braaksma
  http://www.nuntia.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.