Re: [xsl] Element value

Subject: Re: [xsl] Element value
From: "Laura" <xsl_list@xxxxxxxxxxx>
Date: Thu, 21 Nov 2002 10:33:14 -0000
Jarno,
just a naive question..
wouldnt this serve?

<xsl:template match="/">
<element name="{/element/element.name}"/>
</xsl:template>

What are the downsides if any in the above approach apart from the fact that
i have hardcoded the attribute "name" rather than using the string-after()
function to get the attribute's name ( "name" )..
for what Endre needed  as in.
----------------------------------------------------------------------------
-----------------
> I need to tranform 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
----------------------------------------------------------------------------
-----------------
Wouldnt  the template I have given above suffice.

----- Original Message -----
From: <Jarno.Elovirta@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, November 21, 2002 8:48 AM
Subject: RE: [xsl] Element value


> Hi,
>
> > I need to tranform 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
>
> E.g.
>
> <xsl:template match="*">
>   <xsl:copy>
>     <xsl:for-each select="*[contains(local-name(), '.')]">
>       <xsl:attribute name="{substring-after(local-name(), '.')}">
>         <xsl:value-of select="." />
>       </xsl:attribute>
>     </xsl:for-each>
>   </xsl:copy>
> </xsl:template>
>
> Jarno - Xorcist: Xorcist (Bleeding mix)
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread