求各位大侠帮忙看看问题出在哪里
我自学XSLT,试着做了一个,但不出结果:
xml源文件:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/html" href="invoice_output.xmlt" ?>
<invoices xmlns="http://www.huachuangandchengyuan.com/invoice">
<invoice>
<beneficiary>Lu Yan</beneficiary>
<items>
<item>
<item_name>gas</item_name>
<item_amount>370</item_amount>
</item>
</items>
<invoice_date>2019-02-13</invoice_date>
<application_date>2019-02-02</application_date>
</invoice>
</invoices>
xslt转换文件:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="text"/>
<xsl:template match="/">
<html><head><title>This is a test for the invoice output.</title></head>
<body>
<h1>
<xsl:value-of select="/invoices/invoice/beneficiary"/>
</h1>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
我期待的结果是:
<html>
<head>
<title>This is a test for the invoice output.</title>
</head>
<body>
<h1>Lu Yan</h1>
</body>
</html>
而实际结果是
<html>
<head>
<title>This is a test for the invoice output.</title>
</head>
<body>
</h1>
</body>
</html>
请高手帮帮看看为什么<xsl:value-of select="/invoices/invoice/beneficiary"/>提取不了元素的值?