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

default slot payload is missing #20

Open
sashafirsov opened this issue Jun 3, 2023 · 1 comment
Open

default slot payload is missing #20

sashafirsov opened this issue Jun 3, 2023 · 1 comment
Assignees
Labels
bug Something isn't working progress

Comments

@sashafirsov
Copy link
Member

image
The test should cover as <slot>def value</slot> as named one <slot name=x>X value</slot>

@sashafirsov sashafirsov self-assigned this Jun 3, 2023
@sashafirsov sashafirsov added bug Something isn't working progress labels Jun 3, 2023
@sashafirsov
Copy link
Member Author

Substitution of <slot> in template

template payload XSL
<slot name="xxx">yyy</slot> <b slot="xxx">zzz</b> <xsl:copy-of select="//payload/*[@slot='xxx']"/>
<slot name="xxx">yyy</slot> yyy
<slot name="">yyy</slot> <b slot="">zzz</b> <xsl:copy-of select="//payload/*[@slot='']"/> or <xsl:copy-of select="//payload/*[not(@slot)]"/>
<slot>yyy</slot> yyy

The template is XSLT dom with SLOT elements, those have to be replaced with content which would behave according to the table ^^.

SOLUTION

replace the SLOT with conditional ( by payload ) render of payload or SLOT content. I.e.

<!-- slot name=xxx -->
<xsl:choose>
    <xsl:when test="//payload/*[@slot='xxx']">
        <xsl:copy-of select="//payload/*[@slot='xxx']"/>
    </xsl:when>
    <xsl:otherwise>
        <!-- move SLOT content there -->
        yyy
    </xsl:otherwise>
</xsl:choose> 

<!-- slot name= -->
<!-- slot without name attribute same as with -->
<xsl:choose>
    <xsl:when test="//payload/*[@slot='']">
        <xsl:copy-of select="//payload/*[@slot='']"/>
        <xsl:copy-of select="//payload/*[not(@slot)]"/>
    </xsl:when>
    <xsl:otherwise>
        <!-- move SLOT content there -->
        yyy
    </xsl:otherwise>
</xsl:choose> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working progress
Projects
None yet
Development

No branches or pull requests

1 participant