[英]Accessing especific XML element from XSL
Hello everyboby and thanks in advance, 大家好,在此先感谢您,
I have this data in an XML file... 我将这些数据保存在XML文件中...
<equipos>
<equipo>
<partidos resultado="ganados">3</partidos>
<partidos resultado="perdidos">5</partidos>
<partidos resultado="empatados">2</partidos>
<partidos pepe="ganados">3</partidos>
<partidos pepe="perdidos">5</partidos>
<partidos pepe="empatados">2</partidos>
</equipo>
<equipo>
...
</equipo>
<equipo>
...
</equipo>
<equipo>
...
</equipo>
</equipos>
First of all, is this structure correct? 首先,这种结构正确吗? Is so, how can I access from XSL to the value "5" of the specific element
是的,如何从XSL访问特定元素的值“ 5”
<"partidos pepe="perdidos">5
<“ partidos pepe =” perdidos“> 5
Thanks everybody! 谢谢大家!
First of all, is this structure correct?
首先,这种结构正确吗?
Not sure what you mean by "correct". 不知道您所说的“正确”是什么。 The input is a well-formed XML document.
输入的是格式正确的XML文档。 I don't think we can say anything else without knowing what's the purpose here.
我认为我们不知道这是什么目的就不能说其他话。
how can I access from XSL to the value "5" of the specific element
<"partidos pepe="perdidos">
如何从XSL访问特定元素
<"partidos pepe="perdidos">
It depends on your current context. 这取决于您当前的上下文。 In the absence of that, the absolute path to that element would be:
如果没有该元素,则指向该元素的绝对路径为:
<xsl:value-of select="/equipos/equipo/partidos[@pepe='perdidos']"/>
This assumes the other equipo
elements do not have a similar partidos
child. 假设其他
equipo
元素没有类似的partidos
子代。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.