XML : Only display parent node if no child node exists XSLT 1.0

Is it possible to have the table display ONLY parent nodes that do not have child nodes? I only want items AT-2 and AT-3 to display in the table...

XML:

  <root>     <Item type="Acceptance Test">        <jav_acc_id>AT-1</jav_acc_id>        <Relationships>           <Item type="Acceptance Test Requirements">              <related_id>                 <Item type="Requirement">                    <item_number>REQ-1</item_number>                 </Item>              </related_id>           </Item>        </Relationships>     </Item>     <Item type="Acceptance Test">        <jav_acc_id>AT-2</jav_acc_id>     </Item>     <Item type="Acceptance Test">        <jav_acc_id>AT-3</jav_acc_id>     </Item>  </root>    

This is what I have so far that displays it all XSLT1.0:

  <xsl:template match="/root">      <html>          <body>          <table border="1">          <tr bgcolor="#9acd32">              <th>Acceptance Test</th>              <th>Requirement</th>          </tr>            <tr>              <xsl:for-each select="Item">                  <tr>                      <td>                          <xsl:value-of select="jav_acc_id"/>                      </td>                      <td>                          <xsl:value-of select=".//item_number"/>                          <xsl:if test=".//item_number='' or not(.//item_number)">                          <xsl:text>&#160;</xsl:text>                          </xsl:if>                      </td>                  </tr>                 </xsl:for-each>          </tr>          </table>          </body>      </html>  </xsl:template>  </xsl:stylesheet>    

No comments:

Post a Comment