如何检查xslt中是否存在childnode

时间:2016-08-02 07:21:23

标签: xml xslt

我想检查xslt是否存在现有的子节点。我的if语句无法读取现有的子节点。

这是我的if语句:

 <xsl:if test="following-sibling::Blogs/IDs">
         <xsl:for-each select="IDs">
           <xsl:for-each select="Blog[@CategoryId = current()/@id]">
             <li style="display: list-item; opacity: 1;">
               <div class="blog-item">
                 <h3 class="blog-h3">
                 </h3>
                 <span>
                   <a href="" target="_blank">
                     <xsl:value-of select="@UserName"></xsl:value-of>
                   </a>
                 </span>
                 <span>
                   <a href="/Listing/profile/15/udal-bharti" target="_blank">
                     <xsl:value-of select="@ReplyCount"></xsl:value-of>
                   </a>
                 </span>
                 <span>
                   <a href="/Listing/profile/15/udal-bharti" target="_blank">
                     <xsl:value-of select="@Title"></xsl:value-of>
                   </a>
                 </span>
                 <span>
                   <a href="/Listing/profile/15/udal-bharti" target="_blank">
                     <xsl:value-of select="@CatName"></xsl:value-of>
                   </a>
                 </span>
                 <span>
                   <a href="/Listing/profile/15/udal-bharti" target="_blank">
                     <xsl:value-of select="@VisitCount"></xsl:value-of>
                   </a>
                 </span>
                 <p>
                   <xsl:value-of select="@ShortDescription"></xsl:value-of>
                 </p>
               </div>
             </li>
           </xsl:for-each>
         </xsl:for-each>
       </xsl:if>

这是我的xml:

enter code here

 <Blogs><IDs Id="1"></Blogs>

非常感谢帮助。

0 个答案:

没有答案