Subject: [xsl] Transforming elements into attributes From: "Daniel Joshua" <daniel.joshua@xxxxxxxxxxxx> Date: Fri, 30 Apr 2004 15:18:12 +0800 |
Hi, Is there a nice 'readable' way to transform elements into attributes? Currently, I need to copy and paste for each one. XSL: <xsl:template match="form"> <form> <xsl:if test="@name"> <xsl:attribute name="name"> <xsl:value-of select="name"/> </xsl:attribute> </xsl:if> <xsl:if test="@action"> <xsl:attribute name="action"> <xsl:value-of select="action"/> </xsl:attribute> </xsl:if> <xsl:if test="@method"> <xsl:attribute name="method"> <xsl:value-of select="method"/> </xsl:attribute> </xsl:if> <xsl:apply-templates/> </form> </xsl:template> XML: <form> <name>form</name> <url>submit.do</url> <method>post</method> <content> ... </content> </form> Regards, Daniel
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] copy-of all attributes ex, Emmanuil Batsis (Man | Thread | RE: [xsl] Transforming elements int, Daniel Joshua |
RE: [xsl] Add attribute to all node, Animesh Sharma | Date | RE: [xsl] Transforming elements int, Daniel Joshua |
Month |