stefano 99/12/02 16:11:16
Added: stylesheets changes-stylebook.xsl document-stylebook.xsl
faq-stylebook.xsl spec-stylebook.xsl
todo-stylebook.xsl
Log:
Added the xxx->stylebook stylesheets.
I know it seems weird, but it's much easier to go from our DTDs to Pier's one that write
a new Stylebook style from scratch.
At one point, I hope to make Pier use more sofisticated DTD, but for now it works.
Revision Changes Path
1.1 xml-cocoon/stylesheets/changes-stylebook.xsl
Index: changes-stylebook.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="./document-stylebook.xsl"/>
<xsl:template match="changes">
<s1 title="Changes">
<s2 title="Main Developers">
<ul>
<xsl:for-each select="devs/person">
<li>
<anchor name="{@id}"/>
<jump href="mailto:{@email}">
<xsl:value-of select="@name"/>
</jump>
</li>
</xsl:for-each>
</ul>
</s2>
<xsl:apply-templates/>
</s1>
</xsl:template>
<xsl:template match="release">
<s2 title="Cocoon {@version} ({@date})">
<ul>
<xsl:apply-templates/>
</ul>
</s2>
</xsl:template>
<xsl:template match="action">
<li>
<img src="images/{@type}.jpg" alt="{@type}"/>
<xsl:apply-templates/>
<xsl:text>(</xsl:text>
<jump href="#{@dev}">
<xsl:value-of select="@dev"/>
</jump>
<xsl:text>)</xsl:text>
<xsl:if test="@due-to">
<xsl:text> Thanks to </xsl:text>
<jump href="mailto:{@due-to-email}"><xsl:value-of select="@due-to"/></jump>
<xsl:text>.</xsl:text>
</xsl:if>
</li>
</xsl:template>
</xsl:stylesheet>
1.1 xml-cocoon/stylesheets/document-stylebook.xsl
Index: document-stylebook.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- default copy-over's -->
<xsl:template match="*|/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="text()|@*">
<xsl:value-of select="."/>
</xsl:template>
<!-- document section -->
<xsl:template match="document">
<s1 title="{header/title}">
<xsl:apply-templates/>
</s1>
</xsl:template>
<!-- header section -->
<xsl:template match="header">
<!-- ignore -->
</xsl:template>
<!-- body section -->
<xsl:template match="body">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="s1">
<s2 title="{@title}">
<xsl:apply-templates/>
</s2>
</xsl:template>
<xsl:template match="s2">
<s3 title="{@title}">
<xsl:apply-templates/>
</s3>
</xsl:template>
<xsl:template match="s3|s4">
<s4 title="{@title}">
<xsl:apply-templates/>
</s4>
</xsl:template>
<!-- footer section -->
<xsl:template match="footer">
<!-- ignore -->
</xsl:template>
<!-- links -->
<xsl:template match="link|jump|fork">
<jump href="{@href}">
<xsl:apply-templates/>
</jump>
</xsl:template>
<xsl:template match="connect">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="anchor">
<anchor name="{@name}"/>
</xsl:template>
<!-- paragraphs -->
<xsl:template match="p|note|source">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="fixme">
<!-- ignore on documentation -->
</xsl:template>
<!-- lists -->
<xsl:template match="ul|ol|li">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="sl|dl">
<ul>
<xsl:apply-templates/>
</ul>
</xsl:template>
<xsl:template match="dt">
<li>
<em><xsl:value-of select="."/></em>
<xsl:text> - </xsl:text>
<xsl:value-of select="following::dd"/>
</li>
</xsl:template>
<xsl:template match="dd">
<!-- ignore -->
</xsl:template>
<!-- table (just copy over) -->
<xsl:template match="table|tr">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="caption|colgroup|thead|tfoot|tbody">
<!-- ignore -->
</xsl:template>
<xsl:template match="th">
<th colspan="{@colspan}" rowspan="{@rowspan}">
<xsl:apply-templates/>
</th>
</xsl:template>
<xsl:template match="td">
<td colspan="{@colspan}" rowspan="{@rowspan}">
<xsl:apply-templates/>
</td>
</xsl:template>
<!-- specials -->
<xsl:template match="br">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="img-block">
<p>
<img src="{@src}" alt="{@alt}"/>
</p>
</xsl:template>
<xsl:template match="img">
<img src="{@src}" alt="{@alt}"/>
</xsl:template>
<!-- text markup -->
<xsl:template match="strong">
<em>
<xsl:apply-templates/>
</em>
</xsl:template>
<xsl:template match="em">
<ref>
<xsl:apply-templates/>
</ref>
</xsl:template>
<xsl:template match="code">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="sub|sup">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-cocoon/stylesheets/faq-stylebook.xsl
Index: faq-stylebook.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="./document-stylebook.xsl"/>
<xsl:template match="faqs">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="faq">
<faq title="{question}">
<xsl:apply-templates/>
</faq>
</xsl:template>
<xsl:template match="question">
<q>
<xsl:apply-templates/>
</q>
</xsl:template>
<xsl:template match="answer">
<a>
<xsl:apply-templates/>
</a>
</xsl:template>
</xsl:stylesheet>
1.1 xml-cocoon/stylesheets/spec-stylebook.xsl
Index: spec-stylebook.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="./document-stylebook.xsl"/>
<xsl:template match="spec">
<s1 title="{header/title}">
<xsl:apply-templates/>
</s1>
</xsl:template>
<xsl:template match="appendices">
<s2 title="{@title}">
<xsl:apply-templates/>
</s2>
</xsl:template>
<xsl:template match="bl">
<ul>
<xsl:apply-templates/>
</ul>
</xsl:template>
<xsl:template match="bi">
<li>
<em>
<xsl:text>[</xsl:text>
<jump href="{@href}"><xsl:value-of select="@name"/></jump>
<xsl:text>]</xsl:text>
</em>
<xsl:text> "</xsl:text>
<xsl:value-of select="@title"/>
<xsl:text>", </xsl:text>
<xsl:value-of select="@authors"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="@date"/>
</li>
</xsl:template>
</xsl:stylesheet>
1.1 xml-cocoon/stylesheets/todo-stylebook.xsl
Index: todo-stylebook.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="./document-stylebook.xsl"/>
<xsl:template match="todo">
<s1 title="Todo List">
<xsl:call-template name="section">
<xsl:with-param name="priority">showstopper</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="section">
<xsl:with-param name="priority">high</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="section">
<xsl:with-param name="priority">medium</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="section">
<xsl:with-param name="priority">low</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="section">
<xsl:with-param name="priority">wish</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="section">
<xsl:with-param name="priority">dream</xsl:with-param>
</xsl:call-template>
</s1>
</xsl:template>
<xsl:template name="section">
<xsl:if test="/descendant::action[@priority = $priority]">
<s2 title="{$priority}">
<xsl:for-each select="/descendant::action[@priority = $priority]">
<li>
<em><xsl:value-of select="@context"/></em><xsl:text> - </xsl:text>
<xsl:apply-templates/>
</li>
</xsl:for-each>
</s2>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
|