This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
updating childelements
- From: "bernward hanssen" <bernwardhanssen at web dot de>
- To: XSL-List at lists dot mulberrytech dot com
- Date: Wed, 28 Nov 2001 16:34:42 +0100
- Subject: [xsl] updating childelements
- Organization: http://freemail.web.de/
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi
I want to update childelements when the are passed as parameters with the same name as the childelement.
The following works, but I think it is not the way to do it in xsl.
<xsl:template match="item" mode="test">
<item>
<firstname>
<xsl:choose>
<xsl:when test="$firstname"><xsl:value-of select="$firstname"/></xsl:when>
<xsl:otherwise><xsl:value-of select="firstname"/></xsl:otherwise>
</xsl:choose>
</firstname>
<lastname>
<xsl:choose>
<xsl:when test="$lastname"><xsl:value-of select="$lastname"/></xsl:when>
<xsl:otherwise><xsl:value-of select="lastname"/></xsl:otherwise>
</xsl:choose>
</lastname>
<!-- -->
<!-- and that for each element -->
<!-- -->
</item>
</xsl:template>
Knows anybody a better solution?
I try the following, but it doesn't work.
<xsl:template match="*" mode="update">
<xsl:variable name="el">
<xsl:value-of select="name()"/>
</xsl:variable>
<xsl:element name="{$el}">
<xsl:variable name="el">
<xsl:value-of select="concat('$',name())"/>
<!-- this is only the name of the Parameter, I need the content of the Parameter -->
</xsl:variable>
</xsl:template>
______________________________________________________________________________
Hollywood unterm Weihnachtsbaum + ExtraPraemie bei WEB.DE
http://premiere.web.de
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list