I’m developping a custom CQWP using a custom ContentQueryMain.xsl, I am using a list structure with which I would like to have a separator creating a new list each three items. Here is the code of the template:
<xsl:template name="CustomGroupTemplateSimple2">
<ul>
<li>
<ul class="liste1">
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
<xsl:for-each select="$Rows">
<xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
<li>
test
</li>
<xsl:if test="position() mod 3 = 0">
</ul>
</li>
<li>
<ul class="separator">
</xsl:if>
</xsl:for-each>
</ul>
</li>
</ul>
</xsl:template>
The separator is:
</ul>
</li>
<li>
<ul class="separator">
is responsible of the webpart error raised. The following code is working perfectly:
<xsl:template name="CustomGroupTemplateSimple2">
<ul>
<li>
<ul class="liste1">
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
<xsl:for-each select="$Rows">
<xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
<li>
test
</li>
<xsl:if test="position() mod 3 = 0">
SEPARATOR
</xsl:if>
</xsl:for-each>
</ul>
</li>
</ul>
</xsl:template>
And when I DIRECTLY replace the “SEPARATOR” with:
</ul>
</li>
<li>
<ul class="separator">
in the aspx page (after compilation), everything is perfectly working, too.
Therefore, I am really lost with this situation as I really need this separator.
Thank you very much
The reason for the error is obvious: Any XSLT stylesheet must be a well-formed XML document and this provided stylesheet isn’t. This is why even the XML parser that the XSLT processor uses to get its stylesheet module, raises a non-well-formedness exception.
In particular, this fragment:
isnt a well-formed XML fragment, becausethere isn’t any start tag for the end tags
</ul>and</li>.Finally, here is a correct example of such positional grouping:
when this transformation is applied to the following XML document:
the wanted, correctly grouped result is produced: