XML/CSS Style/display

Материал из Web эксперт
Перейти к: навигация, поиск

CSS style for address

File: Data.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="Style.css" ?>
<projects>
  <PROJECT>
    <PROJ_NAME>project name 1</PROJ_NAME>
    <CONTACT>
     <NAME>name 2</NAME>
      <ADDRESS>99999</ADDRESS>
      <PHONE>1111 </PHONE>
      <FAX>2222 </FAX>
      <EMAIL>k@web.ru </EMAIL>
    </CONTACT>
    <CONTACT>
     <NAME>name 3</NAME>
      <ADDRESS>99999</ADDRESS>
      <PHONE>1112 </PHONE>
      <FAX>2222 </FAX>
      <EMAIL>f@web.ru </EMAIL>
    </CONTACT>
    <CONTACT>
     <NAME >name 4</NAME>
      <ADDRESS>99999</ADDRESS>
      <PHONE>1113 </PHONE>
      <FAX>2222 </FAX>
      <EMAIL>l@we.ru </EMAIL>
    </CONTACT>
    <NOTES>
      <ENTRY> entry</ENTRY>
    </NOTES>
  </PROJECT>
</projects>
File: Style.css
projects { 
   font-style: normal;
   color: 000000 
}
PROJECT { 
   display: block;
   background: blue;
   font-family: sans-serif;
   margin: 1cm 
}
PROJ_NAME  { 
   display: block; 
   background: #FF0000;
   font-size: larger;
   font-weight: bold;        
   word-spacing: 2em;
   color: white ; 
   font-family: Arial, Helvetica, sans-serif; 
   border: #FF0000; 
   border-style: double; 
   border-top-width: medium; 
   border-right-width: medium; 
   border-bottom-width: medium; 
   border-left-width: medium
}
CONTACT { 
   display: block;
   padding: 5pt;
   text-indent: 1cm 
}
NAME { 
   display: block;
   font-variant: small-caps;
   font-size: medium;
   font-weight: bold;
   color: red;
   text-decoration: overline;
}
ADDRESS { 
   display: block;
   font-style: italic;
   font-size: smaller;
   color: white
}
PHONE { 
   display: block;
   font-weight: bold;
   font-size: smaller;
   color: white
}
FAX { 
   display: block;
   font-weight: bold;
   font-size: smaller;
   color: white
}
EMAIL { 
   display: block;
   font-weight: bold;
   font-style: italic;
   color: white
}
NOTES { 
   display: block;
   font-weight: bold;
   font-style: italic;
   color: white;
   padding: 3em
}
ENTRY { 
   display: block;
}



display as table tow

File: Data.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="Style.css"?>
<document>
  <table>
    <tableRow>
      <tableCell>Cell 1</tableCell>
      <tableCell>Cell 2</tableCell>
      <tableCell>Cell 3</tableCell>
    </tableRow>
    <tableRow>
      <tableCell>Cell 4</tableCell>
      <tableCell>Cell 5</tableCell>
      <tableCell>Cell 6</tableCell>
    </tableRow>
   </table>
   <tableCaption>Table caption</tableCaption>
</document>
File: Style.css
document {
  color:#000000;
  display:block;
  background-color:#FFFFFF;
  border:solid 2px #000000;
  padding:10px;
  margin:10px;
}
table {
  display:table;
  background-color:#CCCCCC;
  border:solid 2px #000000;
  padding:30px;
}
tableRow {
  display:table-row;
}
tableCell {
  display:table-cell;
  background-color:#FFFFFF;
  border:solid 1px #CCCCCC;
  padding:10px;
}
tableCaption {
  display: table-caption;
}



display block

File: Data.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="Style.css"?>
<PROJECTDB>
  <PROJECT>
    <PROJECTTITLE>title</PROJECTTITLE>
  </PROJECT>
  <PROJECT>
    <PROJECTTITLE>title 2</PROJECTTITLE>
  </PROJECT>
</PROJECTDB>
File: Style.css
PROJECT, PROJECTTITLE  { 
   display: block 
}



Hide with display none

File: Data.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="Style.css"?>
<INVENTORY>
   <BOOK>
      <TITLE>title 1</TITLE>
      <AUTHOR>author 1</AUTHOR>
      <BINDING>mass market paperback</BINDING>
      <PAGES>298</PAGES>
      <PRICE>$5.49</PRICE>
   </BOOK>
   <BOOK>
      <TITLE>title 2</TITLE>
      <AUTHOR>author 1</AUTHOR>
      <BINDING>mass market paperback</BINDING>
      <PAGES>298</PAGES>
      <PRICE>$5.49</PRICE>
   </BOOK>
</INVENTORY>

File: Style.css
BOOK {
   display:block;
   margin-top:12pt;
   font-size:10pt
}
TITLE {
   display:block;
   font-size:12pt;
   font-weight:bold;
   font-style:italic
}
AUTHOR {
   display:block;
   margin-left:15pt;
   font-weight:bold
}
BINDING {
   display:block;
   margin-left:15pt
}
PAGES {
   display:none
}
PRICE {
   display:block;
   margin-left:15pt
}