/*
 * Copyright (c) 2011-2012 Pixware SARL. All rights reserved.
 *
 * This file is part of the XMLmind XML Editor project.
 * For conditions of distribution and use, see the accompanying legal.txt file.
 *
 * Used to style a DocBook document set. See the <documentSetFactory> element
 * in docbook.xxe. 
 */

@import "inline1.imp";
@import "inline2.imp";

*,
*:comment,
*:processing-instruction,
set > *,
book > *,
part > *,
reference > *,
preface > *,
chapter > *,
article > *,
appendix > *,
section > *,
sect1 > *,
sect2 > *,
sect3 > *,
sect4 > *,
sect5 > *,
setinfo > *,
bookinfo > *,
partinfo > *,
referenceinfo > *,
prefaceinfo > *,
chapterinfo > *,
articleinfo > *,
appendixinfo > *,
sectioninfo > *,
sect1info > *,
sect2info > *,
sect3info > *,
sect4info > *,
sect5info > * {
    display: none;
}

set,
book,
part,
reference,
preface,
chapter,
article,
appendix {
    display: block;
    collapsible: yes;
    not-collapsible-head: 1; /* title or metainfo */
    margin-top: 0.5ex;
    margin-left: 4ex;
}

refentry {
    display: block;
    content: "RefEntry: " xpath("join(.//refname, ', ')");
    margin-left: 4ex;
}

glossary {
    display: block;
    content: xpath("if(./glossaryinfo/title, string(./glossaryinfo/title), ./title, string(./title), 'Glossary')");
    margin-left: 4ex;
}

section,
sect1,
sect2,
sect3,
sect4,
sect5 {
    display: block;
    margin-left: 4ex;
}

*:root {
    margin-top: 0;
    margin-left: 0;
}

setinfo:contains-element(title),
bookinfo:contains-element(title),
partinfo:contains-element(title),
referenceinfo:contains-element(title),
prefaceinfo:contains-element(title),
chapterinfo:contains-element(title),
articleinfo:contains-element(title),
appendixinfo:contains-element(title),
sectioninfo:contains-element(title),
sect1info:contains-element(title),
sect2info:contains-element(title),
sect3info:contains-element(title),
sect4info:contains-element(title),
sect5info:contains-element(title) {
    display: block; 
}

title {
    display: block;
    margin: 0 2px; /* This trick allows to make a difference between the title 
                      and its containing division when pressing Up/Down in
                      the DocSetPane. */
}

title * {
    display: inline;
}

title indexterm {
    display: none;
}

set > title,
book > title,
part > title,
reference > title,
preface > title,
chapter > title,
article > title,
appendix > title,
setinfo > title,
bookinfo > title,
partinfo > title,
referenceinfo > title,
prefaceinfo > title,
chapterinfo > title,
articleinfo > title,
appendixinfo > title {
    font-size: 1.1em;
    font-weight: bold;
    margin-top: 0.25ex;
    margin-bottom: 0.25ex;
}

/*
 * Title which is the first child of a division OR
 * Title following in the first (hidden) metainfo child of a division.
 */

set > title:first-child:before,
set > setinfo:first-child + title:before {
    content: collapser() " Set: ";
}

book > title:first-child:before,
book > bookinfo:first-child + title:before {
    content: collapser() " Book: ";
}

reference > title:first-child:before,
reference > referenceinfo:first-child + title:before {
    content: collapser() " Reference: ";
}

preface > title:first-child:before,
preface > prefaceinfo:first-child + title:before {
    content: collapser() " Preface: ";
}

article > title:first-child:before,
article > articleinfo:first-child + title:before {
    content: collapser() " Article: ";
}

part > title:first-child:before,
part > partinfo:first-child + title:before { 
    content: collapser() " Part " simple-counter(n-, upper-roman) ": "; 
}

chapter > title:first-child:before,
chapter > chapterinfo:first-child + title:before { 
    content: collapser() " Chapter " simple-counter(n-, decimal) ": "; 
}

appendix > title:first-child:before,
appendix > appendixinfo:first-child + title:before  { 
    content: collapser() " Appendix " simple-counter(n-, upper-alpha) ": "; 
}

sect1 > title:first-child:before,
sect1 > sect1info:first-child + title:before { 
    content: simple-counter(n-) ". "; 
}

sect2 > title:first-child:before,
sect2 > sect2info:first-child + title:before { 
    content: simple-counter(nn-) ". "; 
}

sect3 > title:first-child:before,
sect3 > sect3info:first-child + title:before { 
    content: simple-counter(nnn-) ". "; 
}

sect4 > title:first-child:before,
sect4 > sect4info:first-child + title:before { 
    content: simple-counter(nnnn-) ". "; 
}

section > title:first-child:before,
section > sectioninfo:first-child + title:before { 
    content: simple-counter(n-) ". "; 
}

section section > title:first-child:before,
section section > sectioninfo:first-child + title:before { 
    content: simple-counter(nn-) ". "; 
}

section section section > title:first-child:before,
section section section > sectioninfo:first-child + title:before { 
    content: simple-counter(nnn-) ". "; 
}

section section section section > title:first-child:before,
section section section section > sectioninfo:first-child + title:before { 
    content: simple-counter(nnnn-) ". "; 
}

section section section * section > title:first-child:before,
section section section * section > sectioninfo:first-child + title:before { 
    content: ""; 
}

/*
 * Title contained in the first metainfo child of a division.
 */

set > setinfo:first-child > title:before {
    content: collapser() " Set: ";
}

book > bookinfo:first-child > title:before {
    content: collapser() " Book: ";
}

reference > referenceinfo:first-child > title:before {
    content: collapser() " Reference: ";
}

preface > prefaceinfo:first-child > title:before {
    content: collapser() " Preface: ";
}

article > articleinfo:first-child > title:before {
    content: collapser() " Article: ";
}

part > partinfo:first-child > title:before { 
    content: collapser() " Part " simple-counter(n--, upper-roman) ": "; 
}

chapter > chapterinfo:first-child > title:before { 
    content: collapser() " Chapter " simple-counter(n--, decimal) ": "; 
}

appendix > appendixinfo:first-child > title:before { 
    content: collapser() " Appendix " simple-counter(n--, upper-alpha) ": "; 
}

sect1 > sect1info:first-child > title:before { 
    content: simple-counter(n--) ". "; 
}

sect2 > sect2info:first-child > title:before { 
    content: simple-counter(nn--) ". "; 
}

sect3 > sect3info:first-child > title:before { 
    content: simple-counter(nnn--) ". "; 
}

sect4 > sect4info:first-child > title:before { 
    content: simple-counter(nnnn--) ". "; 
}

section > sectioninfo:first-child > title:before { 
    content: simple-counter(n--) ". "; 
}

section section > sectioninfo:first-child > title:before { 
    content: simple-counter(nn--) ". "; 
}

section section section > sectioninfo:first-child > title:before { 
    content: simple-counter(nnn--) ". "; 
}

section section section section > sectioninfo:first-child > title:before { 
    content: simple-counter(nnnn--) ". "; 
}

section section section * section > sectioninfo:first-child > title:before { 
    content: ""; 
}
