从样式表中引用XML值 [英] Reference XML value from stylesheet

查看:78
本文介绍了从样式表中引用XML值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个样式表,旨在引用XML文档中的值。 我是XML的新手,不知道如何解释样式表。 我的任务是为现有的样式表创建一个XML文件。 该值目前是从样式表引用的
,如下所示:



< xsl: template match =" / cust">



< xsl:value-of select =" @ custid" />


I我不确定"@"是什么符号意味着但我假设一个参数? 有人能告诉我如何格式化XML文件以便样式表可以工作吗?


解决方案

"select"的值是一个XPath表达式。 '@'表示该项是属性,即custid是/ cust元素的属性。有关XPath的更多信息,请参阅  http://www.w3schools.com/xpath/xpath_syntax.asp

Hi, I have a stylesheet that has been designed to reference a value from an XML document.  I'm new to XML and not sure how to interpret the stylesheet.  I've been tasked with created an XML file for the existing stylesheet.  The value is currently being referenced from the stylesheet like so:

<xsl:template match="/cust">

<xsl:value-of select="@custid"/>

I'm not sure what the "@" symbol means but I assume a parameter?  Can someone tell me how to format the XML file so that the stylesheet will work?

解决方案

The value of "select" is a XPath expression. '@' means the item is an attribute, i.e., custid is an attribute of /cust element. For more information about XPath, please reference to http://www.w3schools.com/xpath/xpath_syntax.asp


这篇关于从样式表中引用XML值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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