gpt4 book ai didi

android - 解析其中包含 XSL 的 XML 时出现问题

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:16:05 24 4
gpt4 key购买 nike

当尝试从网页读取我的 xml 时,我得到:“错误:在第 8 行,第 23 列:未绑定(bind)前缀”下面是我的 xml:

<?xml version="1.0"?>
<outertag>
<innertag sampleattribute="innertagAttribute">
<Retailer>
RetailerName:
<xsl:template match="link">
<a href="LinkGoesHere">Link</a>
</xsl:template>
</Retailer>
</innertag>

有什么问题吗?我不能在我的 xml 中使用 xsl:template 吗?非常感谢任何帮助。

最佳答案

When trying to read my xml from a webpage i get: "Error: At line 8, column 23: unbound prefix" Below is my xml:

<?xml version="1.0"?>
<outertag>
<innertag sampleattribute="innertagAttribute">
<Retailer>RetailerName:
<xsl:template match="link">
<a href="LinkGoesHere">Link</a>
</xsl:template>
</Retailer>
</innertag>
</outertag>

Any ideas as to what is wrong? Can I not use xsl:template within my xml?

提供的文档格式不正确,错误消息很好地说明了原因:

有一个名为xsl:template 的元素,但是整个文档中没有命名空间声明将前缀xsl: 绑定(bind)到任何命名空间。

解决方案:

通过为 XSLT 命名空间提供命名空间声明,将格式不正确的文本更正为格式正确的 XML 文档:

<outertag>
<innertag sampleattribute="innertagAttribute">
<Retailer>RetailerName:
<xsl:template match="link"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<a href="LinkGoesHere">Link</a>
</xsl:template>
</Retailer>
</innertag>
</outertag>

关于android - 解析其中包含 XSL 的 XML 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4772674/

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