[Home] [By Thread] [By Date] [Recent Entries]

  • From: Newsha Makooi <Newsha@i...>
  • To: xml-dev@l...
  • Date: Tue, 15 Aug 2000 16:15:11 -0600

Title: Empty nodes and xsl:for-each select

Dear XMLers,

I am writing in regards to the output table on page 523 of Michael Kay's XSLT, Programmer's Reference. 

In the example XML document, the score value is an attribute of the element.  Let's just say that instead of using attributes to hold the score value we used a <Score>2</Score> element for each <Team>Brazil</Team>

Now, let's say that some of these <Score>2</Score> elements were empty, as in <Score></Score>.  How would you go about building a table, creating an empty cell for your output table based on an empty <Score></Score> value?


I have

<xsl:for-each select="Team/Score" order-by="+ Name">
        <td>
                <xsl:value-of select="."/>
        </td>
</xsl:for-each>

and this causes the table cells not to match up with the table headings, because of the selection part.  You see, the empty <Score></Score> elements are not even selected.  This is a problem since the values are not displayed accurately.

Any <suggestions/>?  Please advise.

Regards,
Newsha


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member