问题
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>
回答1:
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">
.
来源:https://stackoverflow.com/questions/22084693/missing-second-p-tag-how-to-get-it