缺少第二个p标签如何获得它 [英] missing second p tag how to get it

查看:101
本文介绍了缺少第二个p标签如何获得它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有在我的xsl中获得第二个p标签...
在下面提供了我的代码...

http://xsltransform.net/b4GWV9/17

 < xsl:for-each select =child :: *> 
< xsl:if test =normalize-space(。)!=''>
< p class =specifications__value-title>
< / p>
< / xsl:if>
< / xsl:for-each>

提供我的html输出也在

http://jsfiddle.net/F9wh7/

 < li class =specifications__value> 
< p class =specifications__value-title>维度< / p>
**< p class =specifications__value-copy> 5.38 x 2.75 x 0.31英寸< / p> **
< / li>


解决方案

您需要更改

 < xsl:for-each select =child :: * [name()!='SpecificationsHeading']> 

转换为

 < xsl:for-each select =descendant :: * [name()!='SpecificationsHeading']> 

我在您的输出中也注意到有两个< p class = specifications__value标题 > 。也许你的意思是另一个是< p class =specifications__value-copy>


I am not getting the second p tag in my xsl... providing my code below...

http://xsltransform.net/b4GWV9/17

<xsl:for-each select="child::*">
    <xsl:if test="normalize-space(.)!=''">
    <p class="specifications__value-title">
        <xsl:value-of select="." />
    </p>                                            
    </xsl:if>
</xsl:for-each>

providing my html output also below

http://jsfiddle.net/F9wh7/

<li class="specifications__value">
    <p class="specifications__value-title">Dimensions</p>
     **<p class="specifications__value-copy">5.38 x 2.75 x 0.31 inches</p>**
</li>

解决方案

you need to change

<xsl:for-each select="child::*[name()!='SpecificationsHeading']">

into

<xsl:for-each select="descendant::*[name()!='SpecificationsHeading']">

I also noticed in your output that there are two <p class="specifications__value-title">. Maybe you meant the other one to be <p class="specifications__value-copy">.

这篇关于缺少第二个p标签如何获得它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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