EPA-WG/custom-element

default slot payload is missing

Opened this issue · 1 comments

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

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>