Given two XML documents, A:
<base>
<row>
<col1 value='x'/>
<col2/>
</row>
<row>
<col1 value='y'/>
<col2/>
</row>
<row>
<col1 value='z'/>
<col2/>
</row>
</base>
and B:
<base>
<row>
<col1/>
<col2/>
<col3/>
</row>
<row>
<col1/>
<col2/>
</row>
</base>
this xsl will tell if it is "simple" or "complex" based on the number of child elements under each toplevel row element:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding = "iso-8859-1"/>
<!-- is the xml simple? -->
<!-- simple, in this case, means each row has 2 or fewer columns -->
<xsl:variable name="maxColCount">
<xsl:for-each select="//base/row">
<xsl:sort data-type="number" order="descending"/>
<xsl:if test="position()=1"><xsl:value-of select="count(./*)"/></xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$maxColCount > 2">complex</xsl:when>
<xsl:otherwise>simple</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
The result is: A is simple, and B is complex.