Subject: RE: [xsl] Grouping into a table (for vertical alignment) From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx> Date: Mon, 24 May 2004 09:23:58 -0500 |
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">Password: <input type="password" name="password" value="" class="mandatory"> <div class="warning">All attempts are logged..</div> . . . Regards, Daniel
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Grouping into a table (fo, Daniel Joshua | Thread | RE: [xsl] Grouping into a table (fo, Daniel Joshua |
RE: [xsl] XHTML + XSL -> HTML probl, Jarno.Elovirta | Date | [xsl] xsl schould render a vbs-Arra, Hans Pickelmann | Nü |
Month |