getAllStatuses(); $renderer = get_active_status_renderer(); echo ''; } function topic_icons_css() { echo "\n"; } function topic_icons_label( $label ) { global $topic; if (bb_is_front() || bb_is_forum() || bb_is_view() || bb_is_tag()) { $icon_set_name = topic_icons_get_active_icon_set(); $icon_set_url = ICON_SET_URL_BASE . $icon_set_name; $status = get_active_status_interpreter()->getStatus(bb_get_location(), $topic); $renderer = get_active_status_renderer(); $image = $renderer->renderStatus($status); $tooltip = $renderer->renderStatusTooltip($status); $exists = file_exists(dirname(__FILE__).'/icon-sets/'.$icon_set_name.'/'.$image); if (!$exists) { return sprintf(__('
%s
%s'), get_topic_link($topic->topic_id), ICON_SET_URL_BASE.'/empty.png', ICON_WIDTH, ICON_HEIGHT, $tooltip, $label); } else if (strlen($tooltip) > 0) { return sprintf(__('
%s%s
%s'), get_topic_link($topic->topic_id), $icon_set_url.'/'.$image, ICON_WIDTH, ICON_HEIGHT, $tooltip, $tooltip, $label); } else { return sprintf(__('
%s
%s'), get_topic_link($topic->topic_id), $icon_set_url.'/'.$image, ICON_WIDTH, ICON_HEIGHT, $tooltip, $label); } } return $label; } function topic_icons_init( ) { remove_filter('bb_topic_labels', 'bb_closed_label', 10); remove_filter('bb_topic_labels', 'bb_sticky_label', 20); add_filter('bb_topic_labels', 'topic_icons_label', 11); add_action('bb_head', 'topic_icons_css'); add_action('bb_admin_menu_generator', 'topic_icons_admin_page_add'); add_action('bb_admin-header.php', 'topic_icons_admin_page_process'); topic_icons_register_status_interpreter('default', new DefaultStatusInterpreter(BUSY_THRESHOLD)); topic_icons_register_status_renderer('default', new DefaultStatusRenderer()); } topic_icons_init(); ?> Digital Humanities Questions & Answers » Topic: Why does XSLT require weird formatting when I include javascript files? http://digitalhumanities.org/answers/topic/why-does-xsly-require-weird-formatting-when-i-include-javascript-files Digital Humanities Questions & Answers » Topic: Why does XSLT require weird formatting when I include javascript files? en-US Sun, 24 Mar 2019 23:36:24 +0000 http://bbpress.org/?v=1.0.2 <![CDATA[Search]]> q http://digitalhumanities.org/answers/search.php sebastian.rahtz@gmail.com on "Why does XSLT require weird formatting when I include javascript files?" http://digitalhumanities.org/answers/topic/why-does-xsly-require-weird-formatting-when-i-include-javascript-files#post-675 Sat, 13 Nov 2010 10:42:01 +0000 sebastian.rahtz@gmail.com 675@http://digitalhumanities.org/answers/ <p>Bites me all the time. The problem is your web browser not understanding XML (ie empty elements), because it thinks it is<br /> reading HTML. All about mime types and doctypes, and the decision browser takes about whether<br /> to follow HTML or XHTML mode It is probably a lost cause - the defensive use of the nbsp as content<br /> fixes the problem. </p> Karin Dalziel on "Why does XSLT require weird formatting when I include javascript files?" http://digitalhumanities.org/answers/topic/why-does-xsly-require-weird-formatting-when-i-include-javascript-files#post-672 Fri, 12 Nov 2010 17:28:00 +0000 Karin Dalziel 672@http://digitalhumanities.org/answers/ <p><em>Replying to @Stéfan Sinclair's <a href="http://digitalhumanities.org/answers/topic/why-does-xsly-require-weird-formatting-when-i-include-javascript-files#post-666">post</a>:</em></p> <p>That doesn't work with saxon, it still collapses the element if I don't throw a non breaking space in there. We set the output type to xml for a reason at one point, though for the life of me I can't remember why. </p> Stéfan Sinclair on "Why does XSLT require weird formatting when I include javascript files?" http://digitalhumanities.org/answers/topic/why-does-xsly-require-weird-formatting-when-i-include-javascript-files#post-666 Thu, 11 Nov 2010 15:45:47 +0000 Stéfan Sinclair 666@http://digitalhumanities.org/answers/ <p>Karin, it probably varies by processor, but have you tried setting the output format?</p> <div class="bb_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:output</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">&quot;html&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div> Karin Dalziel on "Why does XSLT require weird formatting when I include javascript files?" http://digitalhumanities.org/answers/topic/why-does-xsly-require-weird-formatting-when-i-include-javascript-files#post-665 Thu, 11 Nov 2010 15:40:10 +0000 Karin Dalziel 665@http://digitalhumanities.org/answers/ <p>Ah, yes, I realize my code was wrong in my question, should have has the end script tag. </p> <p>So, related question - is there a setting to make XSLT *stop* converting empty elements to self closing ones? I know this has caused me headaches on more than one occasion. </p> <p>Thanks for the link. :) </p> Joe Gilbert on "Why does XSLT require weird formatting when I include javascript files?" http://digitalhumanities.org/answers/topic/why-does-xsly-require-weird-formatting-when-i-include-javascript-files#post-664 Wed, 10 Nov 2010 22:00:46 +0000 Joe Gilbert 664@http://digitalhumanities.org/answers/ <p>Just to add to Stéfan's answer, most XSLT processors will convert</p> <div class="bb_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;script src=&quot;whatever.js&quot;&gt;&lt;/script&gt;</pre></div></div> <p>to a self-closing element. Since browsers don't expect the tag to be empty, they fail to render everything after the tag (often the entire visible part of the page). </p> Stéfan Sinclair on "Why does XSLT require weird formatting when I include javascript files?" http://digitalhumanities.org/answers/topic/why-does-xsly-require-weird-formatting-when-i-include-javascript-files#post-663 Wed, 10 Nov 2010 21:06:14 +0000 Stéfan Sinclair 663@http://digitalhumanities.org/answers/ <p>This shouldn't really be specific to XSLT, but basically the HTML schema requires a text node (PCDATA) as a child of script (i.e. it can't be empty). See also <a href="http://aspnetresources.com/blog/empty_vs_nonempty_html_tags" rel="nofollow">http://aspnetresources.com/blog/empty_vs_nonempty_html_tags</a> </p> Karin Dalziel on "Why does XSLT require weird formatting when I include javascript files?" http://digitalhumanities.org/answers/topic/why-does-xsly-require-weird-formatting-when-i-include-javascript-files#post-662 Wed, 10 Nov 2010 20:53:12 +0000 Karin Dalziel 662@http://digitalhumanities.org/answers/ <p>I have an XSLT file that writes the HTML for a website. I include the javascript like so: </p> <div class="bb_syntax"><table><tr><td class="line_numbers"><pre>1 </pre></td><td class="code"><pre class="xslt" style="font-family:monospace;">&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot; /&gt;</pre></td></tr></table></div> <p>But if I do that, it breaks the rest of the page. Instead, I have to include the javascript files like so: </p> <div class="bb_syntax"><table><tr><td class="line_numbers"><pre>1 </pre></td><td class="code"><pre class="xslt" style="font-family:monospace;">&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;&gt; &amp;#160; &lt;/script&gt;</pre></td></tr></table></div> <p>So that it does not break. Can anyone tell me why this is? It does not happen with included CSS files, just javascript. </p> <p>Using cocoon to transform the files with Saxon 9. </p>