diazo icon indicating copy to clipboard operation
diazo copied to clipboard

Associativity of conditionals and multiple comma-separated selectors

Open fulv opened this issue 8 years ago • 0 comments

This rule:

<drop
      css:if-not-content="body.frontend"
      css:content='head link[data-bundle="plone-legacy"], head script[data-bundle="plone-legacy"]' />

seems to be applied like this (simplifying a bit for clarity):

drop link OR (script IF NOT body.frontend)

instead of:

drop (link OR script) IF NOT body.frontend

I'm not sure if it's because of the square bracket selectors in the css:content. Probably not, because any attribute selection would result in square brackets in the match expression.

The diazocompiler output:

<!--RULE: <diazo:drop css:if-not-content="body.frontend" 
css:content="head link[data-bundle="plone-legacy"], 
head script[data-bundle="plone-legacy"]" 
xml:id="r1" if-not-content="//body[@class and contains(concat(' ', 
normalize-space(@class), ' '), ' frontend ')]" content="//head//link[@data-bundle = 
'plone-legacy'] | //head//script[@data-bundle = 'plone-legacy']" 
condition="not(//body[@class and contains(concat(' ', normalize-space(
@class), ' '), ' frontend ')])" merged-condition="not(//body[@class and 
contains(concat(' ', normalize-space(@class), ' '), ' frontend ')])"/>-->

<xsl:template match="//head//link[@data-bundle = 'plone-legacy'] | 
//head//script[@data-bundle = 'plone-legacy'][not(//body[@class and 
contains(concat(' ', normalize-space(@class), ' '), ' frontend ')])]">
</xsl:template>

By contrast, if I split the above drop rule into two, one for link and one for script, it works, and the output is:

<!--RULE: <diazo:drop css:if-not-content="body.frontend" 
css:content="head link[data-bundle="plone-legacy"]" 
xml:id="r1" if-not-content="//body[@class and contains(concat(' ', 
normalize-space(@class), ' '), ' frontend ')]" 
content="//head//link[@data-bundle = 'plone-legacy']" 
condition="not(//body[@class and contains(concat(' ', 
normalize-space(@class), ' '), ' frontend ')])" 
merged-condition="not(//body[@class and contains(concat(' ', 
normalize-space(@class), ' '), ' frontend ')])"/>-->

<xsl:template match="//head//link[@data-bundle = 
'plone-legacy'][not(//body[@class and contains(concat(' ', 
normalize-space(@class), ' '), ' frontend ')])]">
</xsl:template>

<!--RULE: <diazo:drop css:if-not-content="body.frontend" 
css:content="head script[data-bundle="plone-legacy"]"
xml:id="r2" if-not-content="//body[@class and contains(concat(' ', 
normalize-space(@class), ' '), ' frontend ')]" 
content="//head//script[@data-bundle = 'plone-legacy']" 
condition="not(//body[@class and contains(concat(' ', 
normalize-space(@class), ' '), ' frontend ')])" 
merged-condition="not(//body[@class and contains(concat(' ', 
normalize-space(@class), ' '), ' frontend ')])"/>-->

<xsl:template match="//head//script[@data-bundle = 
'plone-legacy'][not(//body[@class and contains(concat(' ', 
normalize-space(@class), ' '), ' frontend ')])]">
</xsl:template>

fulv avatar Dec 02 '15 03:12 fulv