|
Subject: matching nodes and counting columns From: "Jonas" <bob@xxxxxxxxxx> Date: Tue, 15 Aug 2000 10:25:38 +0200 |
Hello,
I am trying to convert a html to wml and can't find out how to do two
things.
html is well-formed already.
1. there is such html:
<body>
..
<table> ..... </table>
<table> ..... </table>
<table> ..... </table>
..
</body>
How can I apply one template to first <table> and another template to the
second <table>,
or how can I skip first and third tables and apply template to the second
only?
If I try this:
<xsl:template match="body">
...
<xsl:apply-templates select="table"/>
...
</xsl:template>
then template with match="table" applyed to all <table> tags.
2. <table> tag in wml requires columns attribute with number of colums.
So actually I need to count number of <td> in first <tr> of the table
(lets say there are no colspans and rowspans in html)
<xsl:value-of select="count(tr/td)" /> - gives me a number of all <td> in
the table
I found a way out:
<xsl:value-of select="count(tr/td) div count(tr) "/>
(to divide number of cells by number of rows :-))
but that is probably not the best way doing it
Thanks,
Jonas
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: submitting rtf contained within, David_Marston | Thread | RE: matching nodes and counting col, Ben Robb |
| RE: submitting rtf contained within, Joshua Allen | Date | RE: matching nodes and counting col, Ben Robb |
| Month |