Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
587 views
in Technique[技术] by (71.8m points)

html - missing second p tag how to get it

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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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">.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...