ÍøÂçѧԺ w3popÉçÇø ÍøÂç×ÊÔ´ ITÐÂÎÅ

w3pop.com :: ÍøÂçѧԺ :: XML :: Óà CSS ÏÔʾ XML

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

XML
XML DHTMLÐÐΪ
XML Ïà¹Ø¼¼Êõ
XML ±à¼­Æ÷
XML ÕªÒª
XML ʵÀý
XML×Ö·û±àÂë
xml ÎĵµÊ÷
IEºÍ»ðºü¶ÁÈ¡XML·..

Óà CSS ÏÔʾ XML


×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-29 ÐÞ¸Ä:2007-08-08 ä¯ÀÀ:5165 :: ::

With CSS (Cascading Style Sheets) you can add display information to an XML document.
ÀûÓÃCSS£¨²ãµþÑùʽ±í£©£¬Äã¿ÉÒÔ¸øXMLÎļþÌí¼ÓÏÔʾÐÅÏ¢¡£


Displaying your XML Files with CSS?
ÓÃCSSÏÔʾXMLÎļþ£¿

It is possible to use CSS to format an XML document.
¿ÉÒÔÓÃCSS´¦ÀíXMLµÄÎĵµ²¼¾Ö¡£

Below is an example of how to use a CSS style sheet to format an XML document:
ÏÂÃæÊÇʹÓÃCSSÑùʽ±í´¦ÀíXMLÎļþ²¼¾ÖµÄ°¸Àý£º

Take a look at this XML file: The CD catalog
Çë¿´Õâ¸öXMLÎļþ: CDĿ¼

Then look at this style sheet: The CSS file
ÔÙ¿´¶ÔÓ¦µÄÑùʽ±í: CSSÎļþ

Finally, view: The CD catalog formatted with the CSS file
×îºó£¬¿´µ½µÄÊÇ Í¨¹ýCSS²¼¾ÖºóµÄCDĿ¼ ¡£

Below is a fraction of the XML file. The second line, <?xml-stylesheet type="text/css" href="cd_catalog.css"?>, links the XML file to the CSS file:
ÏÂÃæÁоٵÄÊÇÕâ·ÝXMLÎļþÖÐµÄÆäÖÐÒ»¸ö´úÂë¶Î¡£µÚ¶þÐÐÓï¾ä£º<?xml-stylesheet type="text/css" href="cd_catalog.css"?>£¬ÒâÖ¸°ÑXMLÎļþÁ´½Óµ½CSSÎļþÖУº

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="cd_catalog.css"?>

<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>

<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>

<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tyler</ARTIST>
<COUNTRY>UK</COUNTRY>

<COMPANY>CBS Records</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1988</YEAR>
</CD>

.
.
.
.
</CATALOG>

Note: Formatting XML with CSS is NOT the future of how to style XML documents. XML document should be styled by using the W3C's XSL standard!
×¢Ò⣺
ÓÃCSS¸ñʽ»¯XMLÎĵµ²¢²»ÊǶÔXMLÎĵµ½øÐв¼¾ÖµÄ³¤¾ÃÖ®¼Æ¡£XMLÎļþÓ¦¸ÃʹÓÃW3C's XSL ±ê×¼½øÐÐÑùʽ¶¨ÒåºÍ²¼¾Ö¡£

ÆÀÂÛ (1) 1 All