HTML & CSS
Trying to find way to insert poor "tag soup" html into xhtml.
In IE a cdata seems to work, but in firefox, chrome and safari it doesn't
If its not in cdata, the code invalidates the xhtml.
I've looked at object and iframe, but both require src files.
Needs to be Google, yahoo and bing crawlable.
Obviously it would be nice if there wasn't conditional code either in script or on the server.
Am I sol?
Hi AdsenseThemes, welcome to the forums,
Why not use HTML then?
errmmm. Doesn't embed need a source too?
IMHO you're best off using the object tag if you want XHTML
Second to that - conditional comments.
SOoL? Only if you discount all of the few possible alternatives that work as options.
A CDATA section will let you insert anything (except the triplet
]]>). But it will be text data, of course, not content elements. There is no way to mix HTML markup within an XHTML document.
Note that the XHTML document must be served as proper XHTML (e.g., as
application/xhtml+xml) for CDATA sections to work in some browsers. It's not guaranteed to work with pretend-XHTML (served as
the tag "embed" is deprecated in html 4 and xhtml 1.0, I just meant a way to insert some crappy html into an xhtml.
I could use html 4, and not have the issue with invalid xml, but it really wouldn't fix the problem. the inserted html would still screw up the page and would not validate as correct.
I tried tidy to see if the inserted html could be fixed up, but it didn't fix all the issues.
For that matter you can't have conditional comments in XHTML because only IE supports conditional comments and IE doesn't support XHTML.
Good point. I'm so used to seeing so much fake XHTML I forget that.
Besides the deprecated embed tag, what others are you talking about? AFAIK they can be replaced by using CSS no?
Both embed and iframes were deprecated because the object tag is designed to do what those tags do. In XHTML in particular a single object tag can substitute for an embed tag because the second object tag is only needed to supply special options that IE6 requires in place of the standard params.
IE is the only browser that doesn't handle the object tag correctly as a direct substitute for embed or iframe and so with XHTML there should be no reason for not using the correct object tag.
Apart from IE6 needing its own special version of the object tag the only other issues with using the object tag are that you can't turn off the border in IE8 or earlier and if used for anything other than flash (eg. to contain HTML as a replacement for an iframe) there isn't any way to place other elements in front of it (again only a problem in IE and so limited to HTML and not a problem in XHTML).
OK so for valid xhtml, the options are
1) "tidy" the inserted html to xml fragment
2) use <object type"text/html" src=url> which requires a separate file
How about a xslt tranform? I read that it treats cdata as just a regular text node. Are there any xslt features that could somehow recognize it as html.
Hmm, EMBED was Netscape 'proprietary' rather than 'deprecated' although you could use the extensibility of XHTML and create an EMBED element very easily. Though I don't see a rational reason for you to do so - for obvious reasons regarding MIME and the fact OBJECT is more than capable of embedding in modern browsers.
What exactly are you trying to achieve in the long-run; I understand you want to insert some HTML but why?
Are you trying to show some "rendered HTML" code examples or something within a real XHTML page, in which case you could always use fall-backs or hyperlinks to the code or the object.
It all seems odd to me and I cannot really see the major benefits of such an approach all you seem to be wanting to do is fool the parser - or perhaps I just need some new glasses.
embed has never been part of any HTML recommendation whatsoever, so it couldn't even be deprecated. It's just plain invalid. (Until the Back-to-the-Future team for HTML5 drags its rotting carcass into the light again.)
Nope. XSLT presumes well-formed XML as input. It can output HTML, but not use it as input.
Yes, because that's exactly what it is: Character DATA.
You have two options:
- Transform the HTML into XML before including it into the XHTML document.
- Put the HTML in a separate document and include it with an
NOT that ANY of the stuff discussed here likely has anything to do with your question - since you didn't show us the code you are trying to fix.
No example, everyone is guessing wildly in the dark. That you even are MENTIONING CDATA probably means a lack of well-formedness that should mandate a total rewrite.
Another thing with <embed> is that every browser that supports it also supports using the <object> tag to do the same thing. There are even browsers that support <object> that don't support <embed> and so there is nowhere whatsoever where it would make any sense at all to use <embed> instead of <object>.
One really weird combination tat I have seen used a lot is an embed inside of the particular variant of the object tag used for IE6. Since IE6 is one of the browsers that supports embed that particular construct makes no sense whatever. If you do insist on using embed then the object tag in that instance is just making the code longer than it needs to be and if you are going to use the IE6 version of the object tag you may as well wrap it around the standard version of the object tag that all of the more modern browsers support (possibly including some that do not support embed).