• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XSLT - empty tag

 
Babji Reddy
Ranch Hand
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use XSLT to transform XML to XHTML, So when a particular tag NODE_VAL in XML is empty, I render a textarea tag as below


But the output HTML is different in different runtimes (may be the XALAN.jar is the culprit but cannot control it)
in some instances the XHTML looks like

and the browser happily renders a TEXTAREA widget
but in some instances the XHTML looks like (empty tag)

and the browser either is not displaying the widget or is displaying the wrapping HTML tags (example if the textarea is wrapped in div tag, the div tags are seen in the text area)

What should I code differently in XSLT to always render the XHTML ase


 
Paul Clapham
Sheriff
Pie
Posts: 20208
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are generating XML (which is what XHTML is) then you have no way of controlling how empty elements are rendered in the output, and it shouldn't make any difference anyway.

So if it does make a difference (and from what you say, it does) then it looks to me like the browser isn't treating your output as XHTML, but just as HTML. Perhaps you should investigate why that is.
 
Babji Reddy
Ranch Hand
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the SME of my other forum POST
http://www.coderanch.com/t/452949/HTML-JavaScript/textarea-empty-tag
I should not render the empty tags in XHTML
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're between a rock and a hard place. You can try sending the mdeia type of application/xhtml+xml but If that doesn't work you may be without paddle.
 
Babji Reddy
Ranch Hand
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried that mime type too, and IE7 doesn't understand it
Guess I have to code some workarounds
 
Babji Reddy
Ranch Hand
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got around this issue, with a bit of hack in code by placing a known token in the textarea and removing it from the javascript on page load.
So for now the page is in business.
Thanks for your analysis.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic