The easy way:
Use two templates, one for all the pages in section A and one for B, identical except for the stylesheet used.
The hard way:
create a snippet or TV that determines which section you’re in (would need to check parents of current doc up to "ultimate" parent, the one whose parent is 0) and put that in the template where you normally specify your CSS file.
You could hard-code the template names, or name them "1.css, 2.css, etc" and be able to load them dynamically, or maybe even use the [*pagetitle*] of the doc for the name of the css file. Lots of options here.
ie "if (ulitmate parent) of current doc has id 1, use firstsite.css"
or "use (ultimate parent’s id).css"
( <link rel="stylesheet" type="text/css" href="assets/site/[[GetStylesheet]]" /> )
[later...]
I even wrote a snippet to get the "ultimate" parent. I’m sure it’s pretty clunky and just about anybody could do it better (and probably already has)! But it works. This won’t give you the CSS file to use, but it does tell you which section you’re in. Using this, if you name your CSS files according to the section’s main doc/folder id, (style1.css, style33.css etc) you could do this in your template:
<link rel="stylesheet" type="text/css" href="assets/site/style[[GetUltimateParent]].css" />
// GetUltimateParent - MODx snippet
// recursively searches the document tree
// and returns the "ultimate" parent
// (the one whose parent is 0)
// of the given document.
//
// created 18 Sept 2005 by [email protected]
// released with LGPL licence
//
// [[GetUltimateParent?id=xxx]]
// where xxx is the id of the document
// whose "ultimate" parent you want to find
// omit id argument to use current document's id
$id = isset($id)?$id:$modx->documentIdentifier;
if($id==0) { return false; }
$tblsc = $this->getFullTableName("site_content");
$sql = "SELECT parent FROM $tblsc WHERE id = '$id'";
$result = $modx->dbQuery($sql);
$row = $modx->fetchRow($result);
$pid = $row['parent'];
if($pid == 0) { /* echo $id */ return $id; }
while ($pid != 0) {
$id = $pid;
$sql = "SELECT parent FROM $tblsc WHERE id = '$pid'";
$result = $modx->dbQuery($sql);
$row = $modx->fetchRow($result);
$pid = $row['parent'];
if($pid == 0) { /* echo $id */ return $id; }
}