XML is a simple and standard way to exchange raw data between computer programs, however XML-based data itself does not include information displayed. The style sheet is a document that describes the structure of the structure document, which can describe how these documents are displayed on the screen, or they can also describe their printing effects, and even sound effects. Using a style sheet defines the display mode of XML document data, XML data is separated from its expressions, in line with the industry advocated data or content and representation of the layer separated. In this way, the XML format or document does not repeat some HTML document structures, and the content is full of content. The writer of XML can also focus on the data itself, not affected by the sub-branch of the display method. Not only that, the style sheet also brings another benefit that defines that different stylesumes can make the same data to show different display appearances, thereby suitable for different applications, and can even be displayed on different display devices. In this way, XML data can be reused to meet different application needs. W3C gives two types of style sheet language: CSS, Cascading style Sheets, level connected style sheet language, XSL EXTENSIBLE SHEET, extensible style sheet language.
CSS-Level Connection Style Form Language CSS is a style description rule, which is a style sheet language proposed for HTML. Now it is also possible to apply the display of XML documents, using CSS, we can define HTML or XML documents The display effect of the middle element, including the location of the element, color, background, border, font, typographic format, etc. Xml-stylesheet type = "text / css" href = "CSS style table file path"?>
XML Version = "1.0"?>
xml-stylesheet type = "text / css" href = "hello.css"?>
answer>
xsampdoc>
Hello.css xsampdoc
{
Margin-top: .7in;
Margin-bottom: .7in;
Margin-left: 1.5in;
Margin-Right: 1in;
Color: navy;
Background-color: white;
Display: block
}
Greeting
{
Display: block;
Font-Family: Arial, Helvetica, Sans-Serif; Font-size: 32pt;
Width: 30em;
Color: Red
}
Question
{
Display: block;
Font-size: x-large;
Color: Black
}
Answer.ans
{
Display: block;
FONT-SIZE: 20PT;
Color: Blue
}
XSL XSL is a style sheet for converting an XML document, which contains rules for conversion and formatting XML documents. XSL is divided into two processes in the conversion XML document: first convert the document structure, and then format the document. These two steps can be separated separately, so gradually divide into two branches in the XSL development process: XSLT (Structure Translation) and XSL-FO (Format Output). The XSL-FO role is similar to the role of CSS in HTML, but development is not mature, not introducing here. XPath is a language dedicated to finding information in an XML document that describes how to identify, select, match each constituent element in the XML document, including elements, attributes, text content, and the like. XPath is affiliated with XSLT, so we usually talk together with XSLT and XPath syntax. XML is a database. XPath is SQL language. XML is a file system. XPath is the directory navigation command XSL contains powerful features of XSLT and XPath, so that the XML document can be converted into any other format document, such as XNL documents, HTML documents, XHTML documents, VRML documents, SVG documents.
XSL's basic syntax XML Version = "1.0" encoding = "GB2312"?>
xml-stylesheet type = "text / xsl" href = "student.xsl"?>
student>
student>
student>
roster>
Student.xsl XML Version = "1.0" eNCoding = "GB2312"?>
hEAD>