Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL: How to change element value into attribute value? 2

Status
Not open for further replies.

fanningpj

Programmer
Dec 12, 2001
11
IE
I'm quite new to XSL and all the tutorials seem to be oriented towards XML -> HTML conversions - I want XML -> XML.
I have something like:
<name>
<first>Joe</first>
<last>Soap</last>
</name>
I want to convert this to:
<name first=&quot;Joe&quot; last=&quot;Soap&quot;/>

I've tried:
<xsl:text><name first=&quot;</xsl:text>
<xsl:value-of select=&quot;first&quot;/>
<xsl:text>&quot; last=&quot;</xsl:text>
<xsl:value-of select=&quot;last&quot;/>
<xsl:text>&quot;/></xsl:text>

But this gets treated as Element content as opposed to an Element. I'd be grateful for ant tips.

Thanks
 
<name first=&quot;{first}&quot; last=&quot;{last}&quot;/>

the bit inside the &quot;{}&quot; is an XPath statement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top