了解XSLT中的XPath [英] Understanding XPath in XSLT

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

问题描述

全部,


我是XSLT的新手,在理解

XPath的语法时遇到一些问题,它选择了XML文档中的节点。考虑一下

XML,它包含三个外部XML元素。


< FOO> foo.top.level< / FOO>

< BOO>< FOO> foo.second.level< / FOO>< / BOO>

< CHOO>< BOO>< FOO> foo.third。等级< / FOO>< / BOO>< / CHOO>


我的测试显示

(a)" / * / FOO"导致空字符串

(b)" // FOO"结果为foo.top.level

(c)" / FOO"导致空字符串

(d)" // * / FOO"结果为foo.top.level

(e)" // * / * / FOO"结果为foo.top.level

(f)" // BOO / FOO"结果是foo.second.level


我正在接受这样的结果...


< xsl :variable name =" foo1" select =" / * / FOO" />


我为什么各种XPath选择各种节点而感到绝望。

非常感谢您提供的任何帮助。


谢谢,

TFSquare

All,

I am new to XSLT and having some problems understanding the syntax of
XPath which selects nodes in the XML document. Consider this bit of
XML, which contains three outer XML elements.

<FOO>foo.top.level</FOO>
<BOO><FOO>foo.second.level</FOO></BOO>
<CHOO><BOO><FOO>foo.third.level</FOO></BOO></CHOO>

My testing shows
(a) "/*/FOO" results in a empty string
(b) "//FOO" results in "foo.top.level"
(c) "/FOO" results in a empty string
(d) "//*/FOO" results in "foo.top.level"
(e) "//*/*/FOO" results in "foo.top.level"
(f) "//BOO/FOO" results in "foo.second.level"

I''m picking up the results like this...

<xsl:variable name="foo1" select="/*/FOO"/>

I''m hopelessly confused as to why various XPath''s pick various nodes.
Any help you can provide is greatly appreciated.

Thanks,
TFSquare

推荐答案

在文章< bd ************************** @ posting.google.com>,

tfsquare< tf ****** @ yahoo.com>写道:
In article <bd**************************@posting.google.com >,
tfsquare <tf******@yahoo.com> wrote:
我是XSLT的新手,并且在理解选择XML文档中的节点的XPath的语法时遇到了一些问题。考虑一下
XML,它包含三个外部XML元素。
I am new to XSLT and having some problems understanding the syntax of
XPath which selects nodes in the XML document. Consider this bit of
XML, which contains three outer XML elements.




XML文档不能包含三个外部元素,所以我是惊讶

你没有收到错误。你究竟在做什么?


- 理查德

-

垃圾邮件过滤器:从.com /邮寄给我.net网站,把我的姓氏放在标题中。


FreeBSD规则!



An XML document can''t contain three outer elements, so I''m surprised
you''re not getting an error. What exactly are you doing?

-- Richard
--
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

FreeBSD rules!


好的xml(及相关)教程可以是在此处找到:
http://www.zvon.org

(点击教程和XPATH TUTORIAL例如)


尊重,

Toni Uusitalo


" tfsquare" < TF ****** @ yahoo.com>在消息中写道

news:bd ************************** @ posting.google.c om ...
Good xml (and related) tutorials can be found here:
http://www.zvon.org
(click tutorials and XPATH TUTORIAL for example)

with respect,
Toni Uusitalo

"tfsquare" <tf******@yahoo.com> wrote in message
news:bd**************************@posting.google.c om...
全部,

我是XSLT的新手,在理解
All,

I am new to XSLT and having some problems understanding the syntax of

的语法时遇到一些问题



Toni,
Toni,
在这里可以找到好的xml(及相关)教程:
Good xml (and related) tutorials can be found here:



http://www.zvon.org<<


谢谢,我会检查一下。

TFSquare。


***通过开发人员指南 http://www.developersdex.com ***

不要只是参加USENET ......获得奖励!


http://www.zvon.org<<

Thanks, I''ll check that out.
TFSquare.

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


这篇关于了解XSLT中的XPath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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