给定以下 XML 文件:
<?xml version="1.0" encoding="UTF-8"?>
<doc>
<head>
<title>Introduction</title>
<section>section</section>
<channel>testing/test</channel>
</head>
<body>
<h1>Heading</h1>
<p>Lorem ipsum dolor sit amet.</p>
<p>Donec sed enim.</p>
</body>
</doc>
以及以下 JSTL 片段,其中 xml 已加载到变量“文件”中:
<x:parse var="xml" doc="${file}"/>
<x:out select="$xml//body"/>
我希望得到:
<h1>Heading</h1>
<p>Lorem ipsum dolor sit amet.</p>
<p>Donec sed enim.</p>
但我得到:
Heading Lorem ipsum dolor sit amet. Donec sed enim.
注意,没有标签。我将如何让 JSTL 将标签留在结果中?