DTD 规定语法、语义;DSSSL 定义样式。
A Survey of Stylesheet Languages
Over the years, a number of attempts have been made to produce a standard stylesheet language and, failing that, a large number of proprietary languages have been developed.
DSSSL
International Organization for Standardization (ISO) created DSSSL, the Document Style Semantics and Specification Language. Subsets of DSSSL are supported by Jade and a few other tools, but it never achieved widespread support.
CSS
The W3C CSS Working Group created CSS as a style attachment language for HTML, and, more recently, XML.
XSL
Most recently, the XML effort has identified a standard Extensible Style Language (XSL) as a requirement. The W3C XSL Working Group is currently pursuing that effort.
示例,对于如下的DocBook片断,相应的各种样式表的定义如下:
<para> This is an example paragraph. It should be presented in a reasonable body font. <emphasis>Emphasized</emphasis> words should be printed in italics. A single level of <emphasis>Nested <emphasis>emphasis</emphasis> should also be supported.</emphasis> </para>
dsssl
(element para (make paragraph (process-children))) (element emphasis (make sequence font-posture: 'italic (process-children))) (element (emphasis emphasis) (make sequence font-posture: 'upright (process-children)))
css
para { display: block } emphasis { display: inline; font-style: italic; } emphasis emphasis { display: inline; font-style: upright; }
xsl
<?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" xmlns:fo="http://www.w3.org/XSL/Format/1.0"> <xsl:template match="para"> <fo:block> <xsl:apply-templates/> </fo:block> </xsl:template> <xsl:template match="emphasis"> <fo:sequence font-style="italic"> <xsl:apply-templates/> </fo:sequence> </xsl:template> <xsl:template match="emphasis/emphasis"> <fo:sequence font-style="upright"> <xsl:apply-templates/> </fo:sequence> </xsl:template> </xsl:stylesheet>
Copyright © 2006 WorldHello 开放文档之源 计划 |