dita2html: warning for undefined element
See original GitHub issueCurrenty when there is no template for an element the default rule will fire that generates some bold text wrapper with yellow background (in dita2htmlImpls.xsl). And the comment even says
><!-- (this rule should NOT produce output in production setting) -->
I think a warning on the console (xsl:message) would be much more appropriate to avoid such an element slip to production. Possibly the behavior could be toggled by a new parameter.
BTW: I didn’t find a way to override this rule by my custom plugin without overriding all other rules as well. So I had to patch the original DITA-OT code. (And hope I remember it when upgrading to a new version.) Is there a better way?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
What repercussions do I get by using an undefined HTML ...
I suppose this is invalid HTML, however both Firefox and Chromium proceed to display the element without any problems or console warnings. I...
Read more >How to avoid undefined offset error in PHP ? - GeeksforGeeks
Example: Following PHP code explains how we can access array elements. If the accessed index is not present then it gives an undefined ......
Read more >Undefined index: type in Drupal\Core\Render\Element\Date ...
The undefined index notice is raised for date2, but not date1. Proposed resolution. Change line 65 of core/lib/Drupal/Core/Render/Element/Date.
Read more >Error: Undefined index: render element - Drupal Answers
If you don't set a variables key for a theme hook implementation, the system defaults to expecting a render element .
Read more >How to Determine If Variable is Undefined or NULL in JavaScript
To check if a variable is undefined or null you can use the equality operator == or strict ... Try to get non...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This has probably been in DITA-OT since 1.0. The correct way would be to use
xsl:message
to terminate processing completely, since it’s a bug in the code if we ever have to fall back to default templates for elements.@robander what’s your take, should we treat this as a fatal error in DITA-OT 3.0. It’s not like anyone will actually want the yellow warning in their production output and IMO this equivalent to throwing a
RuntimeException
in Java for programming errors.I’m fine with a terminating message.
I can see how overriding a fallback rule that’s explicitly there to match
"*"
is going to be … difficult to customize, if you want to turn off the message, change it, or insert your own debugging material. Maybe we could handle that with a common mode template, rather than common named template? Go from today’s:to a common:
That seems to have the most flexibility, and lets me override that mode to handle fallback in my own way in different transform types?
[All that said: in out-of-the-box cases this should only show up if something is truly broken, like DITA-OT forgot to code for some core element. I’ve only seen it come up on the rare case where somebody puts their own value in
@class
, or when working on a specialization and I have a typo in@class
.]