gpt4 book ai didi

xml - XSLT和XPath出了点问题

转载 作者:行者123 更新时间:2023-12-03 17:00:29 25 4
gpt4 key购买 nike

我一直在浪费大量时间试图弄清楚xslt的工作原理

我有这个XML

<?xml version="1.0" encoding="UTF-8"?>

<lvl:map xsi:schemaLocation="http://www.ohmeudeus.com lvlMl-v2.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:lvl="http://www.ohmeudeus.com">
<name>String</name>
<myColor>fffffffff</myColor>
</lvl:map>


现在我想通过使用xslt和单词String来制作一个html

所以我的xslt就像

   <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:lvl="http://www.ohmeudeus.com lvlMl-v2.xsd">
<xsl:template match="lvl:map">
<html>
<head>
<title>
normal title
</title>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
The name is <xsl:value-of select="name"/>
</body>
</html>
</xsl:template>

</xsl:stylesheet>


结果给了我名字和颜色
像这样:

字符串fffffffff

我不明白我在做什么错...请帮助我...

我也接受您需要帮助我发现错误的任何提示

最佳答案

这是因为XML中的xmlns:

xmlns:lvl="http://www.ohmeudeus.com"


与您的XSLT中的xmlns不匹配:

xmlns:lvl="http://www.ohmeudeus.com lvlMl-v2.xsd"

关于xml - XSLT和XPath出了点问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10016610/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com