• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XSLT - empty tag

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to the SME of my other forum POST
https://coderanch.com/t/452949/HTML-JavaScript/textarea-empty-tag
I should not render the empty tags in XHTML
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic