0

我是 XML 的新用户。我需要给一个表的费用节点添加一个超链接,元素ID叫做ExpName。我发现最好的方法是使用 XLink 在 XML 中创建超链接,但我尝试了很多次,但页面无法正常工作。谁能帮帮我?该页面位于: http: //www.studentsofferingsupport.ca/portal/Finance/CashTracker.php

$xml_output  = "<?xml version=\"1.0\"?>";
$xml_output .= "<list_of_transactions>";
$xml_output .="<homepages xmlns:xlink='http://www.w3.org/1999/xlink'>";

$sql_select6 = "SELECT Finance_Expenses.ExpID, Finance_Expenses.ExpName,
  Finance_Expenses.Image, lm_user_profiles.FirstName,
  lm_user_profiles.LastName, Finance_Expenses.DateSubmit,
  Finance_Expenses.ChequeNo, Finance_MethodOfPayment.Type
FROM Finance_Expenses, lm_user_profiles, Finance_MethodOfPayment
WHERE Finance_Expenses.user_id = lm_user_profiles.user_id
  AND Finance_MethodOfPayment.PayID = Finance_Expenses.PayID
  AND Finance_Expenses.School IN('".join("','", $chapter)."')
  AND Finance_Expenses.ExpID = '$transID'";

$result6 = mysql_query($sql_select6) or die(mysql_error());

$resultCount6 = mysql_num_rows($result6);

$row6  =  mysql_fetch_array($result6);
#Store transaction detail

$transDetail = "EXPENSE paid by  " . $row6['Type']
  . " " . $row6['Image'] . "";

$transDetail .= $row6['ExpName']."(".$row6['DateSubmit'].") \n";

$row6  =  mysql_fetch_array($result6);
break;

#Populate XML document
$xml_output .= "<Transaction>";
$xml_output .= "<Date>" . $dateBank . "</Date>";
$xml_output .= "<Detail>" . $transDetail . "</Detail>";
$xml_output .= "<DetailType>" . $detailType . "</DetailType>";
$xml_output .= "<Amount>" . $amount . "</Amount>";
$xml_output .= "<TransType>" . $transType . "</TransType>";
$xml_output .= "<DayBalance>" . $dayBalance . "</DayBalance>";
 //$xml_output .= "<a>" . $chapter[0] . "</a>";
$xml_output .= "</Transaction>";
4

1 回答 1

0

使用 XHTML 作为命名空间而不是 XLink 以使超链接正常工作:

<homepages xmlns='http://www.w3.org/1999/xhtml'>

将元素的 ID 添加到超链接:

"<a href='#ExpName'>" . $chapter[0] . "</a>";
于 2012-07-26T22:45:49.953 回答