Skip to content
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

Associativity of conditionals and multiple comma-separated selectors #55

Open
fulv opened this issue Dec 2, 2015 · 0 comments
Open

Comments

@fulv
Copy link
Member

fulv commented Dec 2, 2015

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant