0
XSL과 CSS를 사용하여이 XML 문서를 멋지게 꾸미도록 설정했습니다. 나는이 foreach가 작동하도록 할 수 없으며, 내가 뭘 잘못하고 있는지 확신하지 못합니다. 아무도 아이디어 없어?XSL Foreach가 값을 가져 오지 않음
XML 그것은 빈 데이터를 보여주는 것
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Expense Report</title>
<link type="text/css" rel="stylesheet" href="q3.css" />
</head>
<body>
<div id="container">
<h1>Expense Report</h1>
<br />
<table id="companyInfo" cellspacing="0px">
<tr>
<td>Name:</td>
<td class="data"><xsl:value-of select="expenseReport/companyInfo/name"/></td>
</tr>
<tr>
<td>Email:</td>
<td class="data"><xsl:value-of select="expenseReport/companyInfo/email"/></td>
</tr>
<tr>
<td>Employee Number:</td>
<td class="data"><xsl:value-of select="expenseReport/companyInfo/empNum"/></td>
</tr>
<tr>
<td>Company Number:</td>
<td class="data"><xsl:value-of select="expenseReport/companyInfo/companyCode"/></td>
</tr>
</table>
<table id="timeFrame" cellspacing="0px">
<tr>
<td>Cost Center: </td>
<td><xsl:value-of select="expenseReport/timeFrame/costCenter"/></td>
</tr>
<tr>
<td>Start Date: </td>
<td><xsl:value-of select="expenseReport/timeFrame/startDate"/></td>
</tr>
<tr>
<td>End Date:</td>
<td><xsl:value-of select="expenseReport/timeFrame/endDate"/></td>
</tr>
</table>
<table id="purpose" cellspacing="0px">
<tr>
<td>
Purpose:
</td>
<td width="700px">
<xsl:value-of select="expenseReport/purpose"/>
</td>
</tr>
</table>
<br />
<br />
<table id="techInfo" cellspacing="0px" width="900px">
<tr>
<th>Date</th>
<th>Description</th>
<th>Miles</th>
<th>Milage</th>
<th>Airfare</th>
<th>Other</th>
<th>Meals</th>
<th>Conf.</th>
<th>Misc</th>
<th>Code</th>
<th>Total</th>
</tr>
<xsl:for-each select="expenseReport/technicalInfo">
<tr>
<td><xsl:value-of select="expenseReport/technicalInfo/date"/></td>
<td><xsl:value-of select="expenseReport/technicalInfo/desc"/></td>
<td><xsl:value-of select="expenseReport/technicalInfo/miles"/></td>
<td><xsl:value-of select="expenseReport/technicalInfo/milage"/></td>
<td><xsl:value-of select="expenseReport/technicalInfo/airfare"/></td>
<td><xsl:value-of select="expenseReport/technicalInfo/other"/></td>
<td><xsl:value-of select="expenseReport/technicalInfo/meals"/></td>
<td><xsl:value-of select="expenseReport/technicalInfo/conf"/></td>
<td><xsl:value-of select="expenseReport/technicalInfo/misc"/></td>
<td><xsl:value-of select="expenseReport/technicalInfo/code"/></td>
<td><xsl:value-of select="expenseReport/technicalInfo/total"/></td>
</tr>
</xsl:for-each>
</table>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="q3.xsl"?>
<expenseReport>
<companyInfo>
<name>John Doe</name>
<email>[email protected]</email>
<empNum>1</empNum>
<companyCode>10010011</companyCode>
</companyInfo>
<timeFrame>
<costCenter />
<startDate />
<endDate />
</timeFrame>
<purpose />
<technicalInfo>
<date>9/9/09</date>
<desc>heading to shanghai</desc>
<miles>a lot</miles>
<mileage amt="0.00">1.21</mileage>
<airFare>7</airFare>
<other>fish?</other>
<meals>yes</meals>
<conf>gesundheit</conf>
<misc>champaign</misc>
<code>red</code>
<total price="0.00">107.00</total>
</technicalInfo>
<technicalInfo>
<date>10/10/10</date>
<desc>hawaii vacation</desc>
<miles>a bunch</miles>
<mileage amt="0.00">100.9</mileage>
<airFare>1234.29</airFare>
<other>nope</other>
<meals>lobster dinner</meals>
<conf>Still not sure what this is</conf>
<misc>clubs</misc>
<code>bluish green</code>
<total price="0.00">3000.87</total>
</technicalInfo>
<technicalInfo>
<date>11/11/11</date>
<desc>Moving to Flordia</desc>
<miles>not too many</miles>
<mileage amt="0.00">12.3</mileage>
<airFare />
<other>Stopped at McDonalds</other>
<meals>Big Mac and Fries</meals>
<conf>No Idea</conf>
<misc>Bought Gold Steering Wheel</misc>
<code>clear</code>
<total price="0.00">35.83</total>
</technicalInfo>
</expenseReport>
XSL. 어쩌면이 foreach가 어떻게 작동하는지 모르겠습니다.
확인 ohhhhh! –