XSLTApplyError: xsl:comment : '--' or ending '-' not allowed in comment - plone

I am really new to plone and diazo so forgive me if the answer to question is too obvious.
I was asked to create a diazo theme for a website running on plone. Right now i'm at a state where i where i think the theme is reasonably complete(without rules) and i uploded it via .zip to the plone planing to create the rules in plones rules editor. Made a handful of them and hit the preview button to see whether what i am doing is even repotely going into the right direction but hat it showed was this error.
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module plone.app.theming.browser.mapper, line 245, in getFrame
Module lxml.etree, line 567, in lxml.etree.XSLT.__call__ (src/lxml/lxml.etree.c:124426)
XSLTApplyError: xsl:comment : '--' or ending '-' not allowed in comment
After spending quiet some time with a well known search engine i'm still uncertain if that is a mistake i made in the rules.xml or something the websites admin has to look at.
Any and all help will be appreciated.
Edit version information:
Plone 4.3 (4305)
CMF 2.2.7
Zope 2.13.19
Python 2.7.3 (default, Feb 4 2013, 09:04:32) [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]
PIL 1.7.8 (Pillow)
Edit rules so far
<?xml version="1.0" encoding="UTF-8"?>
<rules
xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo/css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Apply the following rules to standard Plone pages -->
<rules css:if-content="#visual-portal-wrapper">
<theme href="theme.html" />
<!-- Replace title with Plone's page title -->
<replace css:theme="html head title" css:content="html head title" />
<!-- Copy base tag and script tags from Plone -->
<after css:theme-children="html head" css:content="html head base" />
<after css:theme-children="html head" css:content="html head script" />
<!-- Insert your own rules here -->
<!-- Replace logo with Plone's logo -->
<replace css:theme-children="a#brand img" css:content-children="a#portal-logo img"/>
<!-- Replace top navigation with Plone's top navigation -->
<replace css:theme-children="navbar" css:content-children="ul#portal-globalnav"/>
<!-- Replace search with Plone's search -->
<replace css:theme-children="input.search-query" css:content-children="input#searchGadget"/>
<!-- Replace top navigation with Plone's top navigation -->
<replace css:theme-children="documentDescription" css:content-children="documentDescription"/>
</rules>
</rules>
I didn't create that file myself. It was automatically created by plone upon uploading the .zip without a rules.xml in it. The four(that's how far I got until I first stumbled over the error) rules were created by plones editor.
At first I thought i messed up the comments somehow, seeing that is states "--" and "-" in the error message, but i couldn't find where and DW didn't point out any syntac errors either when opening the file in there.
Edit Solution:
Typo found in the theme.html . One comment ended on "->" instead of "-->" which i never new works for html in the first place.

There's some badly formed XML somewhere. It doesn't appear to be in your rules file. Check the theme file.
Every part of the Diazo processing is done with XML and XSLT processors that depend on the input being well-formed XML (or XSLT). That's just as true of the theme and content as of the rules file.
Content coming from Plone should be good XML (the HTML subset). Your rules file looks OK. That leaves the theme file as a candidate for the problem source.

Related

JavaFX Program isnt working when trying to compile with FXML-File [duplicate]

This error,
The processing instruction target matching "[xX][mM][lL]" is not allowed
occurs whenever I run an XSLT page that begins as follows:
<?xml version="1.0" encoding="windows-1256"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="../header.xsl"/>
<xsl:template match="/">
<xsl:call-template name="pstyle"/>
<xsl:call-template name="Validation"/>
<xsl:variable name="strLang">
<xsl:value-of select="//lang"/>
</xsl:variable>
<!-- ////////////// Page Title ///////////// -->
<title>
<xsl:value-of select="//ListStudentFinishedExam.Title"/>
</title>
Note: I removed any leading spaces before the first line, but the error still occurs!
Xerces-based tools will emit the following error
The processing instruction target matching "[xX][mM][lL]" is not allowed.
when an XML declaration is encountered anywhere other than at the top of an XML file.
This is a valid diagnostic message; other XML parsers should issue a similar error message in this situation.
To correct the problem, check the following possibilities:
Some blank space or other visible content exists before the <?xml ?>
declaration.
Resolution: remove blank space or any other
visible content before the XML declaration.
Some invisible content exists before the <?xml ?>
declaration. Most commonly this is a Byte Order Mark
(BOM).
Resolution:
Remove the BOM using techniques such as those suggested by the W3C
page on the BOM in HTML.
A stray <?xml ?> declaration exists within the XML content.
This can happen when XML files are combined programmatically or
via cut-and-paste. There can only be one <?xml ?> declaration
in an XML file, and it can only be at the top.
Resolution: Search for
<?xml in a case-insensitive manner, and remove all but the top XML
declaration from the file.
Debug your XML file. Either there is space or added extra or fewer tags.
For better understanding build the project through the command line. Windows: gradlew build
In my case, AndroidManifest.xml has a blank space at the very first line
<Empty Row> // This Creates the issue
<?xml version="1.0" encoding="utf-8"?>
There was auto generated Copyright message in XML and a blank line before <resources> tag, once I removed it my build was successful.
just remove this line: <?xml version="1.0" encoding="utf-8"?> because this kind of error only come because of this line or you might also check the format of your line according the mentioned line in this answer.
I had a similar issue with 50,000 rdf/xml files in 5,000 directories (the Project Gutenberg catalog file). I solved it with riot (in the jena distribution)
the directory is cache/epub/NN/nn.rdf (where NN is a number)
in the directory above the directory where all the files are, i.e. in cache
riot epub/*/*.rdf --output=turtle > allTurtle.ttl
This produces possibly many warnings but the result is in a format which can be loaded into jena (using the fuseki web interface).
surprisingly simple (at least in this case).
Another reason of the above error is corrupted jar file. I got the same error but for Junit when running unit tests. Removing jar and downloading it again fixed the issue.
in my case was a wrong path in a config file: file was not found (path was wrong) and it came out with this exception:
Error configuring from input stream. Initial cause was The processing
instruction target matching "[xX][mM][lL]" is not allowed.
For PHP, put this line of code before you start printing your XML:
while(ob_get_level()) ob_end_clean();
It's worth checking your server's folders to see if there's a stray pom.xml hanging around.
I found that I had the problem everyone else described with a malformed pom.xml, but in a folder that I didn't expect to be on the server. An old build was sticking around unwelcome D:
For my case, the tab is the trouble maker. Replace the tab with blank should resolve the issue

Modifying dspace discover page in xmlui mirage theme

I'm trying to modify the Mirage theme in DSpace 4.2 to cater to the specific needs of my organization. We want to add our own search box with custom search fields, and modify the search results page.
This is how the default dspace search results page looks like:
After tinkering around with the css and xsl I came up with this layout:
The top search panel was added by me by modifying the page-structure.xsl file. Now, I want to remove the default search box which appears in the results page. I've looked into all the css, xsl and sitemap files.
By inspecting the sitemap files I found that the search is carried out by calling the [dspace-source]/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/discovery/SimpleSearch.java file.
I commented the code sections where the search box was being added, and re-built and re-deployed dspace, but still no success.
Maybe, I'm not looking at the right files, due to lack of understanding.
It would be nice if someone points me in the right direction.
Thanks in advance
You can override the template that generates the search box. In [dspace]/webapps/xmlui/themes/Mirage/Mirage.xsl put this after the <xsl:output indent="yes"/> line:
<xsl:template match="dri:div[#id='aspect.discovery.SimpleSearch.div.discovery-search-box']">
<!-- You can also add content here
to replace the default search box
-->
</xsl:template>
You seem to be on the right path. If you indeed commented out lines after 131, you should see the effect that the box is removed.
So if you are not seeing the change, it's possible that there is something wrong with how you deploy these updates. Can you confirm that you have performed a mvn clean package and ant update before restarting your tomcat?

How to use two different themes depending on the url with diazo?

I need a solution that meets following requirements:
use a diazo theme based on unstyled(!), Theme base (i.e. "Plone Default") with the URL diazotheme.domain.com
use "Sunburst Theme" (or any other Plone Theme) with the URL "sunburst.domain.com"
It seems that diazo not only uses the Base Theme for the diazo theme but also for the "Unthemed host names". Setting the Base Theme in diazo's "##theming-controlpanel" actually changes the Default skin of the Site.
I've posted a solution using diazo in combination with editskinswitcher: https://stackoverflow.com/a/23130398/1659599. I'd like to know whether this is possible without using editskinswitcher.
Take a look at the collective.behavior.localdiazo package.
You can see it in action in http://www.cfa.org.br/rba site, which has a different theme from http://www.cfa.org.br/ main site.
RBA is an instance of Microsite, a Dexterity-based content type defined in sc.microsite.
you'll definitely need a mechanism to activate different skins for the different parts of you site. editskinswitcher is one choice here.
you could also code your own traverser that applies the correct browserlayer and patches the portal_skins tool.
another approach is to allow skin selection in portal_skins and set the skin via a request variable.
the concept is outlined here: https://dev.plone.org/ticket/10311
Do you need to switch plone skin? Or would it be enough to change the diazo theme, using the same (more or less neutral) plone skin?
I use this approach to switch diazo rule set and index.html depending on the path. The two diazo themes uses different resources: images, styles, js, etc., and are very different.
My rules.xml - shortened:
<?xml version="1.0" encoding="UTF-8"?>
<rules
xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo/css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- The theme for my "app" -->
<rules if-path="/app_path /site/app_path">
<theme href="index_app.html"/>
<!-- rules for the specific path -->
</rules>
<!-- The default theme, used for standard Plone web pages -->
<theme href="index.html" css:if-content="#visual-portal-wrapper" />
<!-- Rules applying to a standard Plone web page -->
<rules css:if-content="#visual-portal-wrapper">
<!-- rules for the rest of the site -->
</rules>
</rules>
The same should be doable for domains using p.a.theming theme parameters: https://pypi.python.org/pypi/plone.app.theming#theme-parameters
and using "Conditions based on arbitrary parameters" from http://docs.diazo.org/en/latest/advanced.html
(replace the if-path with if="$host = 'domain'")
UNTESTED! :)

diazo ignores the JavaScript for web statistics

I have a plone 4.2.1 site and I am using various diazo themes. I also use Piwik for web statistics. Unfortunately the javascript for web statistics is being utterly ignored when one of the diazo themes is installed.
I have tried to edit the rules.xml file as suggested in https://groups.google.com/forum/?fromgroups=#!topic/plone-users/VM4b51ergFA, but adding
<!-- Google Analytics JavaScript -->
<after theme-children="/html/body"
content="/html/body/div[#id='visual-portal-wrapper']/div/script" />
does not work for me.
Is there any other option which I can use to fix this issue?
Thanks,
Julian
The viewlet plone.analytics is rendered in the footer viewlet manager:
<browser:viewlet
name="plone.analytics"
manager="plone.app.layout.viewlets.interfaces.IPortalFooter"
class=".view.AnalyticsViewlet"
permission="zope2.View"
/>
The snippet is rendered as it is, so you can identify your script tag in the way you want.
You shoud try
<script id="plone-analytics" ...>YOUR SCRIPT...</script>
And modify the rules.xml to put #plone-analytics in your footer
In Plone 4.2 at least the plone.analytics is not in the visual-portal-wrapper so the rule you try will not work.

collective.xdv - define an alternative theme breaks transform for default theme

I'm using plone 4.0.1 + collective.xdv 1.0rc11 and I need to use different themes.
I'm trying to do as described in a recent question/answer but when I insert a new theme with a condition I get no transform at all for the default theme. Here are some examples of what I tried:
<rules css:if-content="body.section-mysection">
<theme href="mysection.html" />
</rules>
this ends in:
Traceback (innermost last):
Module ZPublisher.Publish, line 132, in publish
Module zope.event, line 23, in notify
Module zope.component.event, line 26, in dispatch
Module zope.component._api, line 138, in subscribers
Module zope.component.registry, line 323, in subscribers
Module zope.interface.adapter, line 575, in subscribers
Module plone.transformchain.zpublisher, line 93, in applyTransformOnSuccess
TypeError
While these:
<theme href="mysection.html" if-path="/mysection/"/>
<theme href="mysection.html" css:if-content="body.section-mysection"/>
both work for the given section BUT for the rest of the portal there is no transform at all.
I tried to specify also the default theme in the rules.xml (even if it's already registered into ##xdv-settings) with <theme href="index.html" /> but got no luck.
What am I missing here?
Thanks in advance,
SimO
First, I would consider moving on to plone.app.theming. The upgrade/change is fairly trivial as I understand it (http://pypi.python.org/pypi/plone.app.theming#migrating-from-collective-xdv) and p.a.theming provides all the latest and greatest features that were developed under collective.xdv.
Second, I would reference this document:
http://diazo.org/advanced.html#multiple-conditional-themes
It sounds like you just need to configure the default theme first, and then add a condition(s) to change the appropriate section when the condition matches. The additional matched theme should not affect the "default" (first matched) theme.
I am not sure if I understand your setup and your specific problem to the full extend, so I just post a working example. Note: we don't use a default theme value in the xdv control panel, since it will be obsolete with plone.app.theming anyway. It also seemed to interfere with setting up theme tempaltes in the rules.xml directly which might be relevant for your specific problem/usecase.
<rules
xmlns="http://namespaces.plone.org/xdv"
xmlns:css="http://namespaces.plone.org/xdv+css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<theme css:if-content="body.section-front-page" href="frontpage.html"/>
<theme css:if-content="body.section-contact" href="contact.html"/>
<!-- Only style actual Plone page and exclude things like /manage -->
<rules css:if-content="#visual-portal-wrapper">
<!-- default theme templates -->
<theme href="theme.html" />
<!-- Add your default transform rules here -->
<rules css:if-content="body.section-contact">
<!-- Theme template is already setup on top of this file -->
<!-- Add section specific rules here -->
<drop css:theme="#sidebar" />
</rules>
</rules>
</rules>
These rules are as close as possible to the setup required by diazo/plone.app.theming and should just need minor adjustments (namespace correction and a search/replace for append/after for example) - I just migrated the site this example has been lifted from to Plone4.1/diazo without any major drawbacks.

Resources