faqts : Computers : Internet : Web : XML

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 10 people (60%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

XML: How can I display XML in an HTML table with three records to a row ? [XSLT]

May 8th, 2005 00:11
Knud van Eeden, Tony Hughes, Jon Thomas,


----------------------------------------------------------------------
--- Knud van Eeden --- 21 September 2001 - 05:07 pm ------------------

XML: XSL: How can I display XML in an HTML table with three records to 
a row?

---
---

Internet: see also:

---

XML: XSL: Tree: Create: Simple: How to create a general tree from XML: 
Overview [table HTML]
http://www.faqts.com/knowledge_base/view.phtml/aid/24207/fid/671

---
---

Tony Hughes:

---

Use this in your stylesheet:

--- cut here: begin --------------------------------------------------

<table cellpadding="3" cellspacing="3">
    <xsl:for-each select="YOURNODE">
        <xsl:if test="position() mod 3 = 1">
            <xsl:text disable-output-
escaping="yes">&lt;tr&gt;</xsl:text>
        </xsl:if>
            <td valign="top" width="33%">


                <xsl:value-of select="SOMETHING"/>
                ............
                ............


            </td>
        <xsl:if test="position() mod 3 = 0">
            <xsl:text disable-output-
escaping="yes">&lt;/tr&gt;</xsl:text>
        </xsl:if>
    </xsl:for-each>
</table>

--- cut here: end ----------------------------------------------------

----------------------------------------------------------------------