XSLT中的循环问题 [英] looping problem in XSLT

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

问题描述

大家好,今天是我使用XSLT的第一天。我可以得到你的帮助吗?

i有这样的xml:

hi all, today is my first day with XSLT. may i get help from you?
i have a xml like this:

<nitf>
<body>
<body.content>
<block>
<p >THE phone-call on Thursday evening</p>
<p>The caller was an active .</p>
<p>He had a point.</p>
<-- like this 100 para-->

</block>
</body.content>
</body>
</nitf>



如果我使用像这样的xslt:


if i use a xslt like this:

<xsl:for-each select="nitf/body/body.content/block">
<p>
            <xsl:value-of select="p"/>
</p>
          </xsl:for-each>



它只返回第一个参数值。

如果我这样使用:


it returns only first para value.
and if i use like this:

<xsl:for-each select="nitf/body/body.content/block/p">
<p>
            <xsl:value-of select="p"/>
</p>
          </xsl:for-each>



然后它什么都没有显示..

如何获得所有100个参数值?


then it shows nothing..
how can i get all 100 para values ?

推荐答案

只有一个块。你需要为p标签上的每一个做一个迭代它们。 (好吧,它不是每个人都有,这是一个匹配的规则)
There is only one block. You need to do a for each on the p tags to iterate over them. ( well, it''s not a for each, it''s a matching rule )


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

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