Dynamically generated CSS @import rule
This is an open discussion with 5 replies, filed under XSLT.
Search
Very nice!
Sweet...
That's a very cool idea. It never occurred to be to do it this way. This'll come handy in a couple of projects we've got coming up.
The student teaching the master? Hmm.
As I'm actually implementing this, I realize the code I supplied above is unnecessarily verbose. This works better:
<style> <xsl:attribute name="type">text/css</xsl:attribute> <xsl:value-of select="concat('@import url(',$root,'/symphony/assets/basic.css);')"/> <xsl:value-of select="concat('@import url(',$root,'/symphony/assets/admin.css);')"/> <xsl:value-of select="concat('@import url(',$root,'/symphony/assets/code.css);')"/> <xsl:value-of select="concat('@import url(',$workspace,'/assets/css/calendar.css);')"/> </style>
I was actually referring to the clever use of page type for CSS importing. It's especially helpful in large, modular projects.
But in any case, it would be a wonderful day if you guys were all better at XSLT than I am! It'll promote the idea that XSLT isn't all that hard.
Create an account or sign in to comment.
I had always wanted to do this but kept getting tripped up on the
type="text/css"
attribute turning my XSL instructions into text. I finally clued into the idea that I could assign the type with anxsl:attribute
instruction. That way, you can import the appropriate style sheet based on a$page-type
parameter: