首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >此XML文件似乎没有任何与其关联的样式信息。文档树如下所示。2

此XML文件似乎没有任何与其关联的样式信息。文档树如下所示。2
EN

Stack Overflow用户
提问于 2015-04-08 20:41:05
回答 1查看 8.6K关注 0票数 0

在django模板中使用以下代码时:

代码语言:javascript
运行
复制
  <!DOCTYPE html>

<html lang="en">

<head>
<link href="http://52.11.183.14/static/wiki/bootstrap/css/wiki-bootstrap.css" type="text/css" rel="stylesheet"/>
<link href="http://52.11.183.14/static/wiki/bootstrap/css/simple-sidebar.css" type="text/css" rel="stylesheet"/>
<title> Profile - Technology βιβλιοθήκη </title>
</head>
<body>
<div class="container">


    {% for p in profiles %}
     {{p}}
    {% endfor %}


</div>
</body>
</html>

我收到以下错误:

代码语言:javascript
运行
复制
This XML file does not appear to have any style information associated with it. The document tree is shown below.

为什么?我能做些什么来修复它呢?

已解决:通过在render_to_response上更改HttpResponse

代码语言:javascript
运行
复制
   my_context={'profiles': profiles}
   c = RequestContext(request,{'profiles': profiles})
   return render_to_response('wiki/profile.html',
                      my_context,
                      context_instance=RequestContext(request))
   #return HttpResponse(t.render(c), content_type="application/xhtml+xml")
EN

回答 1

Stack Overflow用户

发布于 2017-03-19 21:29:21

你必须用这个替换你的内容html标签。

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="rtl" xmlns="http://www.w3.org/1999/xhtml">
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29514915

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档