如何根据XML中的属性显示元素? [英] How do I display the elements based on their attribute in XML ?

查看:61
本文介绍了如何根据XML中的属性显示元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如:这是一个xml文件(books.xml)



< book>

< Author name = erty> 4546

<作者姓名=njkh> 536

<作者姓名=nmkj> 767

<作者姓名=uhdf> 8746





我想只显示其属性(名称)值为的元素erty。

我如何使用javascript在html中显示。



我尝试过:



我发现可以使用jquery选择器和document.queryselectorAll()...但我不知道如何在html中使用这些。



请尽快回复。

谢谢!

For ex: this is a xml file(books.xml)

<book>
<Author name="erty">4546
<Author name="njkh">536
<Author name="nmkj">767
<Author name="uhdf">8746


I want to display only the element whose attribute(name) value is "erty".
How do i display that in html using javascript.

What I have tried:

I found that jquery selector and document.queryselectorAll() can be used ...but i dont know how to use these in html.

Please reply as soon as possible.
Thanks!

推荐答案

XSLT是转向的方式XML转换成HTML(或其他格式)......

XSLT转换 [ ^ ]
XSLT is the way to turn XML into HTML (or other formats)...
XSLT Transformation[^]


这篇关于如何根据XML中的属性显示元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆