XML 파일을로드하면 데이터가 표시되지 않습니다. 그것은 XSL 파일을 사용하지 않는 것, 그냥 빈 화면이 나타납니다. 제발 누군가가 외모를 가지고 왜 이런 일을 할 수 있는지 알아보십시오. 미리 감사드립니다. Heres는XSL을 사용하여 XML이 표시되지 않음
내 코드 :
XML :
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="computers.xsl"?>
<!DOCTYPE computers SYSTEM "computers.dtd">
<computers>
<computer>
<cpu ghz="3.5" unlocked="Yes">Intel i7 3770k</cpu>
<motherboard>MSI M-Power</motherboard>
<ram>8</ram>
<storage>
<hdd>1000</hdd>
<ssd>128</ssd>
</storage>
<gpu group="ATI">7950</gpu>
<psu>750</psu>
</computer>
<computer>
<cpu ghz="3.5" unlocked="Yes">Intel i5 3570k</cpu>
<motherboard>ASRock Extreme 4</motherboard>
<ram>8</ram>
<storage>
<hdd>1000</hdd>
</storage>
<gpu group="ATI">7870</gpu>
<psu>600</psu>
</computer>
<computer>
<cpu ghz="3.5" unlocked="No">Intel i5 3550</cpu>
<motherboard>ASRock Extreme 3</motherboard>
<ram>8</ram>
<storage>
<hdd>500</hdd>
</storage>
<gpu group="GeForce">9600GT</gpu>
<psu>500</psu>
</computer>
</computers>
DTD :
<!ELEMENT computer (cpu,motherboard,ram,storage,gpu,psu) >
<!ELEMENT cpu (#PCDATA)>
<!ELEMENT motherboard (#PCDATA)>
<!ELEMENT ram (#PCDATA)>
<!ELEMENT storage(hdd,ssd*)>
<!ELEMENT hdd (#PCDATA)>
<!ELEMENT ssd (#PCDATA)>
<!ELEMENT gpu (#PCDATA)>
<!ELEMENT psu (#PCDATA)>
<!ATLIST cpu
ghz CDATA #REQUIRED
unlocked (Yes|No) "No">
<!ATLIST gpu
group (ATI|GeForce) "ATI">
XSL :
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>HELLO WORLD</title>
</head>
<body>
<xsl:for-each select="computers/computer">
<table border="1">
<tr>
<td>
<xsl:value-of select="cpu"/>
</td>
<td>
<xsl:value-of select="cpu/@ghz"/>
</td>
<td>
<xsl:value-of select="cpu/@unlocked"/>
</td>
</tr>
<tr>
<td>
<xsl:value-of select="motherboard"/>
</td>
</tr>
<tr>
<td>
<xsl:value-of select="ram"/>
</td>
</tr>
<tr>
<td>
<xsl:for-each select="storage"/>
<xsl:value-of select="hdd"/>
<xsl:value-of select="ssd"/>
</xsl:for-each>
</td>
</tr>
<tr>
<td>
<xsl:value-of select="gpu"/>
</td>
</tr>
<tr>
<td>
<xsl:value-of select="psu"/>
</td>
</tr>
</table>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
다른 브라우저 (duh)를 사용하여 확인하지 않았습니다. 파이어 폭스로 시도해 봤는데 괜찮 았어. 고마워. – edcarr
@edcarr, 오신 것을 환영합니다. –