I want to perform a conditional include in XSLT, but xsl:include is a top level element. You can only use xsl:if or xsl:choose inside of a template. Is there any kind of hac
Try inverting the structure: if you have two special purpose modules pink.xsl and blue.xsl, and a general-purpose module baby.xsl, then instead of trying to import/include one of pink.xsl or blue.xsl into baby.xsl, instead use pink.xsl or blue.xsl as the top-level entry stylesheet, and have each of these two import baby.xsl. That's the way it was designed to be used, it's nto a hack or a workaround.
Alternatively, given this description of your scenario "My external xml file is a bunch of xslt code fragments", a better approach in your case might be to assemble the stylesheet from these fragments as a separate step, using an XSLT tranformation rather than using xsl:include/xsl:import.