Eclipse BIRT - XHTML output - xhtml

Is there a way to set BIRT to output a report as XHTML (1.0 Transitional would be fine) instead of HTML?
I did a few tests and there are some elements that are not valid:head does not include a title, html must have a namespace (xmlns) attribute
Is this functionality supported at all by BIRT?
----- EDIT -----
Here are the current changes I need to make on the current HTML output produced by BIRT:
Change the doctype to xhtml transitional
Add the xmlns attribute to the html tag
Add the title element in the <head>
Set the missing end tag to the meta tag(s): </meta>
If the functionality is not supported by BIRT, how can I extend the current HTML emitter to transform the current HTML output to valid XHTML?

This is not one of the standard output formats. You should be able to extend the HTML emitter with little effort to do this yourself.
Here are some resources to get started extending BIRT:
Writing a BIRT Extension
Tutorial
Writing a custom emitter (XML in
this case)
Good Luck!

Related

Which output formats support action="passthrough"? (XHTML doesn't - frowny)

We have source documentation in DITA that targets multiple products using the "product" attribute. Our publishing tool supports XHTML input and supports conditionalized output, but 'dita' seems to ignore action="passthrough" for the xhtml target.
What other output formats support action="passthrough"? Maybe I can hack up a temporary workaround. Thanks!
From what I remember, it was considered that in XHTML-based outputs you cannot have "data-" attributes because they are not part of the XHTML transitional specification. So the passthrough works only for HTML 5.
So this XSLT stylesheet:
dita-ot\plugins\org.dita.xhtml\xsl\dita2xhtml-util.xsl
matches all such data- attributes and eliminates them:
<xsl:template match="#*[starts-with(name(), 'data-')]" mode="add-xhtml-ns" priority="10"/>
I see you opened an issue on the DITA OT issues list:
https://github.com/dita-ot/dita-ot/issues/2955
I added the same comment on the issue and maybe we'll discuss there more with the DITA OT devs.

Is there any possible ways to develop JSF based web application by using a template designed in HTML5 and CSS? [duplicate]

Having read about HTML5 support in JSF 2.2, I was surprised to find the same XHTML doctype as in previous Facelets versions in the template file created with a new web application in Netbeans. The only difference is that the HTML tag reads in JSF 2.2:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
, rather than as follows in older JSF versions:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
It seems a bit wrong to keep using XHTML with the promise of HTML5 in mind. I only have the option to use 2.2 if I choose it from "registered libraries" instead of "server library". Does this affect the way the framework version is applied to the project?
Is Facelets too much dependent on XHTML to support HTML5?
It seems that you misunderstood the purpose of XHTML like as many people during the XHTML overhype a couple of years ago. Long story short: check our XHTML wiki page. Carefully read it. In a nutshell, Facelets absolutely doesn't care about the doctype being used in the generated HTML output. You can perfectly fine declare a HTML5 doctype in a Facelets template.
It's indeed unfortunate that Netbeans by default prepares the document with XHTML doctype while HTML5 is these days the recommended doctype. I don't do Netbeans, but in Eclipse you can easily edit those templates and even create your own. You can just replace the whole XHTML doctype by a HTML5 one. You can find/create those templates via Web » HTML Files » Editor » Templates in IDE prefs.
Please note that the HTML5 support in JSF 2.2 has got nothing to do with being able to support specifically the HTML5 doctype. On the contrary, this is supported on all JSF versions, even when legacy JSP is being used. JSP and Facelets are view technologies which allows you to generate HTML output, which can perfectly fine be HTML5 as good. This is also elaborated in the following closely related answer: Is it possible to use JSF+Facelets with HTML 4/5?
Instead, the HTML5 support in JSF 2.2 covers the possibility to define custom JSF component attributes and turning custom HTML elements into JSF components. This was not possible in JSF 2.1 and before. Any custom JSF component attributes (including the HTML5-recommended data-xxx attributes) were simply ignored by the default JSF renderers. See also the following related answer: Custom HTML tag attributes are not rendered by JSF. In JSF 2.2 you can easily specify custom attributes by the new http://xmlns.jcp.org/jsf/passthrough namespace as follows:
<html ... xmlns:a="http://xmlns.jcp.org/jsf/passthrough">
...
<h:inputText ... a:autocorrect="off" />
This will end up in the by <h:inputText> unsupported attribute autocorrect to actually be included in the generated HTML output. Note that I use a XML namespace prefix of a ("attribute") instead of p as shown in the Java EE tutorial, as it would otherwise clash with default XML namespace prefix p of PrimeFaces.
Turning custom HTML elements (including HTML5 elements) into JSF components is a matter of specifying a jsf attribute such as jsf:id.
<html ... xmlns:jsf="http://xmlns.jcp.org/jsf">
...
<header jsf:id="header">...</header>
<main jsf:id="main">...</main>
<footer jsf:id="footer">...</footer>
Those will under the covers be turned into UIPanel (like as <h:panelGroup>). And yes, they are referencable in e.g. <f:ajax render>.
In other words, "HTML5 support" is just again another buzzword for "Custom attribute support".

Is there any HTML 5 construct that is ONLY supported in the XML serialization?

Does there exist any "thing"(element, DOM manipulation, styling, nesting of elements, attributes, anything of that sort...) one can do in XHTML 5, that one CANNOT do in HTML 5? I remember reading on the web about one such case, but I cannot recall where it is I saw it.
This is apart from the use of content from external namespaces such as SVG and MathML (which is supported in HTML as well).
For reference, the number of answers to the converse question "what can you do in HTML 5 that you can't in XHTML 5?" are very large, given the strictness of XHTML. Hence I'm looking for answers to this question.
Yes, for example entity declarations and references to entities so defined. They are part of XML, so they must be supported when using XML serialization, as it is required to follow generic XML rules. Example:
<!DOCTYPE html [
<!ENTITY foo "Hello world">
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Demo</title>
</head>
<body>
&foo;
</body>
</html>
XHTML, being XML supports xml-stylesheet declarations. Not just CSS but also XSLT. Which can transform the document tree before presentationXSLT also supports inclusions via document("foo.xml"), which can be used as an XInclude surrogate since no browser supports the latter right now.
XML parsers validate well-formedness
XHTML supports namespaces, allowing other XML content (not just SVG and MathML) to be embedded
CDATA sections
.innerHTML, .insertAdjacentHTML() and .createContextualFragment() validate well-formedness
The topic is quite interesting in general. E.g. an XHTML5 parser is not quite the same as a pure XML parser, as the HTML5 spec mandates a few willful violations of the XML parser, e.g. to support the <template> element.
There also are a handful of states in which you can have a valid DOM that will throw an error if you try to export it through the XHTML fragment serialization algorithm.
And the HTML Fragment serialization algorithm may emit a string which will result in a different DOM when parsed again by a HTML parser.
So basically all three of the following are not fully isomorphic to one another, in any combination:
the XHTML5 serialization
the (X)HTML5 DOM
the HTML5 serialization.
In XHTML, you can use self-closing syntax (/>) on non-void elements:
<script src="js.js" />
And void elements can have stray end tags:
<input></input>
I was able to find what I was remembering vaguely in this unofficial Q&A by hsivonen. I'm still looking for other such "features".
[...] In this case, you must avoid constructs that aren’t supported in text/html (e.g. div as a child of p).
Searching about more, I found this page (second post from top) :
but basically a p can never enclose a div in HTML (or XHTML served with the mime type text/html). If you are serving XHTML with an XML mime type, you can do this in theory, but the result would not be valid XHTML.
saying that the HTML parser simply doesn't allow the possibility, while the XHTML parser, which doesn't need to second-guess the code, accepts it but it's still invalid.
I decided to test it out : took an application/xhtml+xml page, tried to add a div inside a p using Chrome dev tools "Edit as HTML" function. It worked. I copied the source, made the same change and tested it in validator.nu. It marked it as invalid, to my slight disappointment.
Trying to add a div in a text/html page in the same manner was impossible. As soon as I exited the "Edit as HTML" mode, it simply moved the div after the p.

Extending xhtml schema to support custom tags and attributes

I want to provide the xml schema for custom tags and attributes, which are extending xhtml, so that I would have auto suggest in the IDE (I am using WebStorm) for standard html tags and attributes and for my custom. The namespace should not be used, so that as in the example below the name of the element is my-custom-element, but not my:custom-element.
I have achieved this with DTD have this:
<!ENTITY % XHTML1-strict PUBLIC "-//W3C//XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/html4/strict.dtd" >
%XHTML1-strict;
<!ELEMENT my-custom-element ANY>
Is it possible to do the same using xsd?
Update:
The above example is not correct, as new custom element is auto completed only outside of html tag
Use the HTML5 DTD from Komodo, which is an extension of the XHTML DTD, as a guideline for adding new elements. There are several tools to convert DTD2XSD and XSD2DTD, such as:
dtd2xsd.xsl
dtd2xsd.pl
xsd2dtd.xsl
Custom DTD

Correct content type for html use?

I was using XHTML on my website but that completely destroyed jQuery and its plugins.
Therefore, I want to go back to html 4. I am defining some custom attributes for my html, like so:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd" [
<!ATTLIST mytag myattribute CDATA #IMPLIED>
]>
This seems to be valid html for, but when I pass such a page from my server with a content type of text/html, my browser displays ']>' - it can't parse the doctype properly.
Is there a different content type I should be using?
From A List Apart
If you run such a file through the W3C validator, you find that it
validates wonderfully well. If you download the sample files for this
article and validate file internal.html, you can see this for
yourself. Unfortunately, when you display the file in a browser, the
]> shows up on the screen. There’s no way around this bug, so this
approach is right out.
So this basically isnt going to work. To get it to work you need to copy the DTD you want the server/local machine, edit it appropriately and put it in a publically accessible place. See the article for more detail.
As far as jQuery is concerned, it should work fine if you quit trying to customize the DTD in the fashion that you are. Im not sure about using a custom DTD as I have never done it, but just adding the attributes to the elements and not defining them in the DTD shouldnt cause a problem with jq. Granted the document wont validate, but validation is just a tool and not overly important in the grand scheme of things.

Resources