-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in <replace> #54
Comments
I'm seeing the same issue with
which becomes
in XSL and works, clearing the However, in versions of Diazo after 1.1.2 (that feature commit 1f411eb), the result is an error from Diazo (in Plone) when applying the theme:
because the the resulting XSL looks like what @fulv has shown:
The reason I was using Suggestions on a replacement syntax? |
The changes involved were to support easier modification of content by supporting For the text case you should probably use:
For the attributes case I think this should work:
|
@lrowe For the attribute, that works if I want to drop it, but I replace the attribute with a value, in this case, empty, overriding the default <replace content="//*[@class = 'portlet toc']/@class">
<xsl:attribute name="class"><xsl:value-of select="."/> pull-right well well-large</xsl:attribute>
</replace> which is extending the classes of a given element, adding Bootstrap-compatible classes. As above, an In addition to adding to or replacing attributes, there's also rules written for Diazo 1.0.6 which involve
Thanks for your help on how make this work with the latest Diazo. |
Any news or official direction about this? We already found two websites that can't be upgraded from 4.3.7 to 4.3.10 without pinning the old diazo. |
after one year since last keul's comment, working on a plone 5.0.6 and latest versions of diazo (1.2.5) and plone.app.theming (2.0.1) the issue, it seems to me, is still there. |
same here, still using diazo 1.0.6. @lrowe maybe you can point me and others to the right direction. how can the same as the following be achieved with diazo > 1.0.6? the aim is to copy all body class attributes from content to theme and add additional classes <copy attributes="class" css:theme="body" css:content="body" />
<replace content="/html/body/@class">
<xsl:attribute name="class"><xsl:value-of select="."/> brand1</xsl:attribute>
</replace> @lrowe, @ebrehault is there a way to solve this problem with a current version of diazo? maybe you can give me (and other having this issue) any pointers how to solve this and not having to pin diazo to 1.0.6 the official docs did not help mw: |
Hi @frisi, This regression was not intentional, and I think the described use case makes sense, but apparently it was not part of the existing unit tests, hence I broke it without being aware. I do not remember a lot about how it works, but I do remember it is super difficult and pretty painful to debug (xslt is difficult per se, but here we use xslt to generate xslt :) ). I imagine the fix is about to add a proper Sorry I cannot be more helpful. |
thanks @ebrehault. |
Is this unfixable? |
Between Diazo v 1.0.6 and v 1.2.1 (which ship with Plone 4.3.6 and Plone 5.0, respectively), something broke in the way
<replace>
works.The simplest test case I can think of to reproduce this issue is this:
<replace content="//a/text()" />
.Using
diazocompiler
I compared the xslt produced by the two versions.1.0.6
The output of the rule results in all
<a>
elements being stripped of their content, though the element and its attributes are untouched. For example,<a>home</a>
becomes<a></a>
.1.2.1
In Plone 5 all
<a>
elements have their content duplicated, i.e.<a>home</a>
becomes<a>homehome</a>
.(By the way, note how the comment explaining where these transforms originated from is gone in
diazocompiler
's output for most rules.)I'm not sure what the
before-content, after-content, replace-content
are supposed to do, but it seems they are at the root of the problem.The reason why I stumbled onto this issue is because I was looking for a way to wrap the content of an element with another element, e.g.
<a>home</a> ---> <a><span>home</span></a>
. I was not able to do it with plain Diazo rules, but had to revert to straight xsl, which is a shame:The text was updated successfully, but these errors were encountered: