[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Attribute to Element

Subject: RE: Attribute to Element
From: Mark Dewey <MDewey@xxxxxxx>
Date: Thu, 5 Oct 2000 16:03:41 -0400
xslt transform attribute to element
Thanks for trying. It worked beautifully with XSLT, but didn't work with
XSL.
MSXML2.0 transformed the node like this:

<parameters>
  <{@name}>23</{@name}>
  <{@name}>24</{@name}>
</parameters>

-----Original Message-----
From: Evan Lenz [mailto:elenz@xxxxxxxxxxx]
Sent: Thursday, October 05, 2000 1:39 PM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: RE: Attribute to Element


XSLT solution (I don't know if it will work with old XSL or not):

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="parameters">
    <xsl:copy>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="parameter">
    <xsl:element name="{@name}">
      <xsl:value-of select="."/>
    </xsl:element>
  </xsl:template>

</xsl:stylesheet>

Hope this helps,

Evan Lenz
elenz@xxxxxxxxxxx
http://www.xyzfind.com
XYZFind, the search engine *designed* for XML
Download our free beta software: http://www.xyzfind.com/beta


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Mark Dewey
Sent: Thursday, October 05, 2000 6:19 AM
To: 'XSL-List@xxxxxxxxxxxxxxxx'
Subject: XSL: Attribute to Element


I'm having a problem using XSL to transform an attribtue to an element in an
XML to XML transformation.

For example, given the following XML:

<parameters>
	<parameter name="Key1">23</parameter>
	<parameter name="Key2">24</parameter>
</parameters>

I would like the resulting XML to appear as:

<parameters>
	<Key1>23</Key1>
	<Key2>24</Key2>
</parameters>

Further, my solution needs to use XSL, not XSLT, since my company is
currently using ver. 2.6 of Microsoft MSXML.  (We won't upgrade to ver. 3.0
and XSLT until Microsofts releases a production version.)  A solution in
either version would be helpful since we will upgrade, but my immediate need
is for the XSL version.

Thank you.


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


 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.