DTD and XSLS changes for modules.

This commit is contained in:
Ruslan Ermilov 2011-09-05 09:32:00 +00:00
parent 82854d0d78
commit cd7b80a8bb
4 changed files with 160 additions and 47 deletions

View File

@ -1,24 +1,72 @@
<!ELEMENT module (section+) >
<!ATTLIST module title CDATA #REQUIRED
link CDATA #REQUIRED
lang (en) #REQUIRED
<!ELEMENT module (section+) >
<!ATTLIST module
name CDATA #REQUIRED
id ID #REQUIRED
>
<!ELEMENT section (directive+ | para+) >
<!ATTLIST section title CDATA #REQUIRED
name CDATA #IMPLIED
<!ELEMENT section (directive+ | para+) >
<!ATTLIST section
name CDATA #REQUIRED
id ID #IMPLIED
>
<!ELEMENT directive (syntax, default, context, para+) >
<!ATTLIST directive name CDATA #REQUIRED >
<!ELEMENT directive (syntax+, default, context+, para+) >
<!ATTLIST directive
name ID #REQUIRED
appeared-in CDATA #IMPLIED
>
<!ELEMENT syntax (#PCDATA | value)* >
<!ELEMENT default (#PCDATA)* >
<!ELEMENT context (#PCDATA)* >
<!ELEMENT syntax (#PCDATA | argument | code | parameter | value)* >
<!ELEMENT para (#PCDATA | value)* >
<!ELEMENT value (#PCDATA)* >
<!ELEMENT default (#PCDATA | code)* >
<!ENTITY nbsp "&#xA0;" >
<!ENTITY mdash "&#xA0;- " >
<!ELEMENT context (#PCDATA)* >
<!ELEMENT para (#PCDATA | argument | c-def | c-func | code | command | emphasis | example | header | http-error | link | list | note | parameter | value | var)* >
<!ELEMENT argument (#PCDATA)* >
<!ELEMENT c-def (#PCDATA)* >
<!ELEMENT c-func (#PCDATA)* >
<!ELEMENT code (#PCDATA | value)* >
<!ELEMENT command (#PCDATA)* >
<!ELEMENT emphasis (#PCDATA)* >
<!ELEMENT example (#PCDATA)* >
<!ELEMENT header (#PCDATA)* >
<!ELEMENT http-error EMPTY >
<!ATTLIST http-error
code CDATA #REQUIRED
text CDATA #IMPLIED
>
<!ELEMENT link (#PCDATA)* >
<!ATTLIST link
doc CDATA #IMPLIED
id CDATA #IMPLIED
>
<!ELEMENT list (listitem+) >
<!ATTLIST list
type (bullet | enum) #REQUIRED
>
<!ELEMENT listitem ANY >
<!ELEMENT note ANY >
<!ELEMENT parameter (#PCDATA)* >
<!ELEMENT value (#PCDATA)* >
<!ELEMENT var (#PCDATA)* >
<!ENTITY nbsp "&#xA0;" >
<!ENTITY mdash "&#xA0;- " >

View File

@ -1,19 +1,48 @@
X:stylesheet {
X:template = "section[@name and @title]" {
<a name="{@name}" /> <center><h4> !{@title} </h4></center>
!!;
}
X:template = "section[not(@name) and @title]" {
<center><h4> !{@title} </h4></center>
!!;
}
X:template = "section[not(@name) and not(@title)]" { !!; }
X:template = "para" { <p> !!; </p> }
X:template = "value" { <i> !!; </i> }
X:template = "section[@id and @name]" {
<a name="{@id}" /> <center><h4> !{@name} </h4></center>
!!;
}
X:template = "section[not(@id) and @name]" {
<center><h4> !{@name} </h4></center>
!!;
}
X:template = "section[not(@id) and not(@name)]" { !!; }
X:template = "para" { <p> !!; </p> }
X:template = "c-def" { <code> !!; </code> }
X:template = "c-func" { <code> !!; X:text{()} </code> }
X:template = "code" { <code> !!; </code> }
X:template = "command" { <code> !!; </code> }
X:template = "example" { <blockquote><pre> !!; </pre></blockquote> }
X:template = "emphasis" { <strong> !!; </strong> }
X:template = "header" { <code> !!; </code> }
X:template = "http-error" {
<i> X:text{&quot;} !{@text} X:text{&quot;} </i>
X:text{ (} !{@code} X:text{)}
}
X:template = "link[@id and not(@doc)]" { <a href="#{@id}"> !!; </a> }
X:template = "link" { <u> !!; </u> }
X:template = "list[@type='bullet']" { <ul> !!; </ul> }
X:template = "list[@type='enum']" { <ol> !!; </ol> }
X:template = "listitem" { <li> !!; </li> }
X:template = "argument" { <code><i> !!; </i></code> }
X:template = "parameter" { <code> !!; </code> }
X:template = "value" { <code> !!; </code> }
X:template = "var" { <code> !!; </code> }
}

View File

@ -1,15 +1,51 @@
X:stylesheet {
X:template = "directive" {
<a name="{@name}" /> <center><h4> !{@name} </h4></center>
!! "syntax";
!! "default";
!! "context";
!! "para";
}
X:template = "syntax" { X:text {syntax: } !!; <br/> }
X:template = "default" { X:text {default: } !!; <br/> }
X:template = "context" { X:text {context: } !!; <br/> }
X:template = "directive" {
<hr/>
<a name="{@name}"/>
<!-- <center><h4> !{@name} </h4></center> -->
!! "syntax";
!! "default";
!! "context";
X:if "(@appeared-in)" {
<strong>appeared in version</strong>: !{@appeared-in}
}
!! "para";
}
X:template = "syntax" {
X:if "position() = 1" {
<strong>syntax</strong>:
} else {
<code>&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</code>
}
<code> !!; </code> <br/>
}
X:template = "default" {
<strong>default</strong>:
X:if "count(text()) = 0" {
<strong>none</strong>
} else {
<code> !!; </code>
}
<br/>
}
X:template = "context" {
X:if "position() = 1" {
<strong>context</strong>:
}
X:if "count(text()) = 0" {
<strong>any</strong>
} else {
<code> !!; </code>
}
X:if "position() != last()" {
X:text{, }
} else {
<br/>
}
}
}

View File

@ -10,7 +10,7 @@ X:strip-space elements = "*";
-->
X:param XML = "'../xml'";
X:var LINK = "/module/@link";
X:var ID = "/module/@id";
X:include href = "directive.xslt";
X:include href = "content.xslt";
@ -19,7 +19,7 @@ X:include href = "content.xslt";
X:template = "/module" {
<html><head>
<title> !{@title} </title>
<title> !{@name} </title>
</head>
<body>