Subject: RE: [xsl] Grouping into a table (for vertical alignment) From: "Daniel Joshua" <daniel.joshua@xxxxxxxxxxxx> Date: Tue, 25 May 2004 12:04:53 +0800 |
>Your output is not XHTML, it is plain HTML Ooops, forgot to add in: <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/> Ok, now its XHTML. >and your question seems not XSLT but HTML related...? I know how to do a table in html: <table> <tr> <td> </td> </tr> </table> But what I am asking for is how do I put everything into a table to make sure it is aligned correctly. Regards, Daniel -----Original Message----- From: Pieter Reint Siegers Kort [mailto:pieter.siegers@xxxxxxxxxxx] Sent: Monday, 24 May, 2004 10:24 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] Grouping into a table (for vertical alignment) Hi Daniel, Your output is not XHTML, it is plain HTML - and your question seems not XSLT but HTML related...? Cheers, <prs/> -----Original Message----- From: Daniel Joshua [mailto:daniel.joshua@xxxxxxxxxxxx] Sent: Monday, May 24, 2004 8:12 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] Grouping into a table (for vertical alignment) Hi, I am trying to make a generic XSLT for converting XML into XHTML. I want to put my output into a <table> for vertically aligning the 'label' and 'input' fields. Here's a simplified example... XML (Input): . . . <form> <name>form</name> <action>submit.do</action> <method>post</method> <content> <text> <value>Please enter your Name and Password.</value> <class>instruction</class> </text> <input> <name>username</name> <label>Name: </label> <value></value> <class>mandatory</class> </input> <password> <name>password</name> <label>Password :</label> <value></value> <class>mandatory</class> </password> <text> <value>All attempts are logged.</value> <class>warning</class> </text> </content> </form> . . . XSLT: . . . <xsl:template match="form"> <form> <xsl:for-each select="name | action | method"> <xsl:attribute name="{name()}"> <xsl:value-of select="."/> </xsl:attribute> </xsl:for-each> <xsl:apply-templates"/> </form> </xsl:template> <xsl:template match="text"> <div> <xsl:for-each select="class"> <xsl:attribute name="{name()}"> <xsl:value-of select="."/> </xsl:attribute> </xsl:for-each> <xsl:value-of select="value"/> </div> </xsl:template> <xsl:template match="label"> <xsl:value-of select="."/> <xsl:text>: </xsl:text> </xsl:template> <xsl:template match="input"> <xsl:apply-templates select="label"/> <input> <xsl:attribute name="type"> <xsl:text>text</xsl:text> </xsl:attribute> <xsl:for-each select="name | value | class"> <xsl:attribute name="{name()}"> <xsl:value-of select="."/> </xsl:attribute> </xsl:for-each> </input> </xsl:template> <xsl:template match="password"> <xsl:apply-templates select="label"/> <input> <xsl:attribute name="type"> <xsl:text>password</xsl:text> </xsl:attribute> <xsl:for-each select="name | value | class"> <xsl:attribute name="{name()}"> <xsl:value-of select="."/> </xsl:attribute> </xsl:for-each> </input> </xsl:template> . . . XHTML (Output): . . . <form name="form" action="submit.do" method="post"> <div class="instruction">Please enter your Name and Password.</div> Name: <input type="text" name="username" value="" class="mandatory"></input> Password: <input type="password" name="password" value="" class="mandatory"></input> <div class="warning">All attempts are logged..</div> </form> . . . Regards, Daniel
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Grouping into a table (fo, Pieter Reint Siegers | Thread | Re: [xsl] Grouping into a table (fo, David Carlisle |
[xsl] XSLT2: Clustering, or Groupin, A. Pagaltzis | Date | RE: [xsl] XSLT2: Clustering, or Gro, Michael Kay |
Month |