Turtle Styles

Styles in Turtle instead of CSS.

Why Turtle Styles?

Mostly for the fun of it. However, Turtle Styles has a few conventions that make it more convenient than CSS in some cases:

How Do I Write Turtle Styles?


<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="turtle.js"></script>
<script type="text/javascript" src="turtle-style.js"></script>

<style type="text/turtle">
	@prefix :     <http://ontologi.es/turtle-style#> .
	@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
	@prefix foaf: <http://xmlns.com/foaf/0.1/> .

	<>
		a foaf:Document ;
		:sequence (
			[
				rdf:type :RuleSet ;   # this can be left out - it's implied.
				:selector "//h2[strong]" ;
				:color "green" ;
				:backgroundColour _:myBackground
			]
		) .

	_:myBackground rdf:value "#ffffcc" .
</style>

See also the source code of this page for a "live" example.

Tested in Opera 10 and Firefox 3.