|
Subject: RE: [xsl] Element value From: "bryan" <bry@xxxxxxxxxx> Date: Thu, 21 Nov 2002 10:46:07 +0100 |
Magyary Endre wrote:
>I need to transform an element value to an attribute value:
>input:
><element>
><element.name>hello</element.name>
></element>
>output:
><element name="hello"/>
>I have no idea ho to refer the element's value in an xsl:template
>Thank you, Endre
try this:
<xsl:template match="element">
<xsl:for-each select="*">
<xsl:variable name="attname" select="substring-after(local-
name(),'element.')"/>
<xsl:if test="$attname != ''">
<element>
<xsl:attribute name="{$attname}"><xsl:value-of
select="."/>
</xsl:attribute>
</element>
</xsl:if>
</xsl:for-each>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Element value, "Brož Jiří, Ing. 110 | Thread | RE: [xsl] Element value, bryan |
| Re: [xsl] XSL-FO Wysiwyg designer, Oleg Tkachenko | Date | RE: [xsl] Element value, bryan |
| Month |