Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- </head>
- <body>
- <h2>audi</h2>
- <table>
- <thead>
- <tr>
- <th>Total of samples per second</th>
- <th>Time</th>
- <th>Total of TRUE</th>
- <th>Total of FALSE</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>3</td>
- <td>1950</td>
- <td>2</td>
- <td>1</td>
- </tr>
- <tr>
- <td>2</td>
- <td>2300</td>
- <td>1</td>
- <td>1</td>
- </tr>
- </tbody>
- </table>
- <h2>renault</h2>
- <table>
- <thead>
- <tr>
- <th>Total of samples per second</th>
- <th>Time</th>
- <th>Total of TRUE</th>
- <th>Total of FALSE</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>2</td>
- <td>1500</td>
- <td>2</td>
- <td>0</td>
- </tr>
- <tr>
- <td>2</td>
- <td>2800</td>
- <td>1</td>
- <td>1</td>
- </tr>
- </tbody>
- </table>
- </body>
- </html>
- <xsl:template match="trade">
- <xsl:for-each-group select="car" group-by="@brand">
- <h2>{current-grouping-key()}</h2>
- <table>
- <thead>
- <tr>
- <th>Total of samples</th>
- <th>Time</th>
- <th>Total of TRUE</th>
- <th>Total of FALSE</th>
- </tr>
- </thead>
- <xsl:variable name="sorted-cars" as="element(car)*">
- <xsl:perform-sort select="current-group()">
- <xsl:sort select="xs:integer(@time)"/>
- </xsl:perform-sort>
- </xsl:variable>
- <tbody>
- <xsl:for-each-group select="$sorted-cars" group-adjacent="@time idiv 1000">
- <tr>
- <td>{count(current-group())}</td>
- <td>{current-group()[last()]/@time}</td>
- <td>{count(current-group()[@trend = 'true'])}</td>
- <td>{count(current-group()[@trend = 'false'])}</td>
- </tr>
- </xsl:for-each-group>
- </tbody>
- </table>
- </xsl:for-each-group>
- </xsl:template>
Add Comment
Please, Sign In to add comment