btw, just ignore the '@'... typo
Regards,
Daniel
-----Original Message-----
From: Daniel Joshua [mailto:daniel(_dot_)joshua(_at_)gridnode(_dot_)com]
Sent: Friday, 30 April, 2004 3:18 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Transforming elements into attributes
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
--+------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--