This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: testing for child node and counting


just found the answer to my questions...

1. <xsl:if test="./field_c">
2. <xsl:value-of select="count(Orders/Row/field_c)"/>

--- alex <shortestpath@yahoo.com> wrote:
> Hi, I have an xml like this:
> 
> <Orders>
>     <Row att="...">
>         <field_a>...</field_a>
>         <field_b>...</field_b>
>     </Row>
>     <Row att="...">
>         <field_a>...</field_a>
>         <field_b>...</field_b>
>         <field_c>...</field_c>
>     </Row>
>     ...
> </Orders>
> 
> 
> 1. I want to go through each <row> and create 
>    an html table row only if <row> contains a
>    <field_c> child. I've tried this but it 
>    didn't work:
> 
> <xsl:for-each select="Orders/Row">
>   <xsl:if text="Orders/Row/field_c">
> 
>      <tr>
>        <td><xsl:value-of select="field_c"/></td>
>      </tr>
> 
>   </xsl:if>
> </xsl:for-each>
> 
> 2. I want to print at the top of the html table
>    the number of <row>s that have a <field_c>
>    child.
> 
> Thanks in advance for any help.
> -alex

__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]