XML/CSS Style/xml stylesheet

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

Link style with XML document

File: Data.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="Style.css"?>
<article>
  <title>Styling XML documents with CSS</title>
  <section>
    <title>Introduction</title>
    <para>this is a test.</para>
    <para>topics:</para>
    <itemizedlist>
      <listitem>
        <para>A</para>
      </listitem>
      <listitem>
        <para>B</para>
      </listitem>
      <listitem>
        <para>C</para>
      </listitem>
      <listitem>
        <para>D</para>
      </listitem>
    </itemizedlist>
  </section>
</article>
File: Style.css
article {
  color:#000000;
  background-color:#FFFFFF;
  font-family:arial, verdana, sans-serif;
}
title {
  font-style:italic;
}
title, para {
  display:block
}
listitem {
  display:list-item; list-style: circle outside; margin-left: 2em
}



Style for two tags

File: Data.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="Style.css"?>
<page>
  <history>line1
   </history>
  <pullQuote>
    quote
   </pullQuote>
  <paragraph>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
   nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut
   wisi enim ad minim veniam, quis nostrud exercitation ulliam corper suscipit
   lobortis nisl ut aliquip ex ea commodo consequat. Duis autem veleum iriure dolor
   in hendrerit in vulputate velit esse molestie consequat, vel willum lunombro
   dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio
   dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te
   feugait nulla facilisi. 
  </paragraph>
</page>
File: Style.css
paragraph {
  display:block;
  padding:10px;
  border:solid 2px #A3A3A3;
  margin: 10px;
}
pullQuote,history {
  float:right;
  width:20%;
  font-style:italic;
  border:solid 1px #CCCCCC;
  padding:10px;
  margin:10px;
  background-color: #FFFFFF;
}