Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's something that gets you most of the way there. Replace from your <code>This is not a complete XSL transformation code</code> comment to the last <code>&lt;/xsl:stylesheet&gt;</code>.</p> <pre><code>&lt;replace css:content="#portal-personaltools"&gt; &lt;ul class="list-inline navbar-btn navbar-right" id="account-info"&gt; &lt;li&gt; &lt;xsl:apply-templates select="./dt/a" /&gt; &lt;/li&gt; &lt;li class="btn btn-primary dropdown"&gt; &lt;a id="drop1" href="#" role="button" class="dropdown-toggle" data-toggle="dropdown"&gt;Account&lt;b class="caret"&gt;&lt;/b&gt;&lt;/a&gt; &lt;ul class="dropdown-menu" role="menu" aria-labelledby="drop1"&gt; &lt;xsl:apply-templates select="./dd/ul/li" /&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/replace&gt; &lt;replace css:content="#portal-personaltools dt a"&gt; &lt;a&gt; &lt;xsl:attribute name="class"&gt;btn btn-primary&lt;/xsl:attribute&gt; &lt;xsl:copy-of select="@*|node()" /&gt; &lt;/a&gt; &lt;/replace&gt; &lt;replace css:content="#portal-personaltools dd li"&gt; &lt;li role="presentation"&gt; &lt;xsl:apply-templates select="./a" /&gt; &lt;/li&gt; &lt;/replace&gt; &lt;replace css:content="#portal-personaltools dd li a"&gt; &lt;a role="menuitem" tabindex="-1"&gt; &lt;xsl:attribute name="href"&gt; &lt;xsl:value-of select="@href" /&gt; &lt;/xsl:attribute&gt; &lt;xsl:value-of select="node()" /&gt; &lt;/a&gt; &lt;/replace&gt; </code></pre> <p>This exercises Diazo's ability to <a href="http://docs.diazo.org/en/latest/advanced.html#modifying-the-content-on-the-fly" rel="nofollow">modify content on the fly</a>.</p> <p><strong>Update (corresponding to OP's update):</strong></p> <p>My rule of thumb is to limit Diazo HTML rewriting only to very predictable, uniform HTML. Otherwise you end up with overly complex XSLT that's difficult to maintain and is prone to breakage (e.g. what happens when a minor Plone upgrade alters the personal tools markup?) I would switch to a different Diazo/plone.app.theming capability at this point: <a href="https://pypi.python.org/pypi/plone.app.theming/#advanced-modification" rel="nofollow">the ability to fetch content from a supporting view</a> by specifying an <code>href</code> attribute. That is, replace all of your personal tools rules with a one-liner:</p> <pre><code>&lt;replace css:theme="#account-info" css:content="#account-info" href="/@@account-menu" /&gt; </code></pre> <p>... and write a browser view <code>account-menu</code> in a Python package, where you have Python and Zope Page Templates at your disposal.</p> <p>(Note: it's not appropriate here, but if your browser view was very simple you could use <a href="https://pypi.python.org/pypi/plone.app.themingplugins/#registering-new-views-from-zope-page-templates" rel="nofollow">plone.app.themingplugins' shortcut for registering a view without a Python package</a>.)</p> <p>Or, you could keep your original rule</p> <pre><code>&lt;replace css:theme="#account-info" css:content="#portal-personaltools" /&gt; </code></pre> <p>... and override the <code>plone.personal_bar</code> viewlet (which is registered in the <code>plone.app.layout</code> package). One disadvantage is that the markup would also be overridden in the unthemed site (i.e. the default 'Sunburst' theme you see at <code>http://127.0.0.1/Plone</code>).</p> <p>I would use the Diazo rule with <code>href</code>, and write my own view based on the <code>plone.personal_bar</code> viewlet.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload