2 回答

TA貢獻2041條經驗 獲得超4個贊
將您的 XSLT 文件更改為
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" href="style.css"/>
</head>
<body>
<xsl:for-each select="library/book[author='Mario Vargas Llosa']">
<h1>Title:
<xsl:value-of select="title"/>
</h1>
<p>
<strong>Author: </strong>
<xsl:value-of select="author"/>
</p>
<p>
<strong>Publishing date: </strong>
<xsl:value-of select="publishDate/@year"/>
</p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
你的xsl:for-each意志會迭代<book>“馬里奧·巴爾加斯·略薩”的所有內容。所以輸出(在你的瀏覽器中)將是

TA貢獻1786條經驗 獲得超11個贊
XSLT 中的一行修改。您需要添加一個謂詞。
<xsl:for-each select="library/book[author='Mario Vargas Llosa']">
- 2 回答
- 0 關注
- 118 瀏覽
添加回答
舉報