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

Move one node in xml down one level

Subject: Move one node in xml down one level
From: "SianMace" <sianmace@xxxxxxxxxxx>
Date: Mon, 7 Feb 2005 14:50:53 -0000
xml move node
Hi,

I would like to Move one element down a level, and removing it from its
original location, and making another copy further down.

Heres what i have

XML
<ItemSearchResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <OperationRequest
xmlns="http://webservices.amazon.com/AWSECommerceService/2005-01-19">
  <Items
xmlns="http://webservices.amazon.com/AWSECommerceService/2005-01-19">
   <Item>
    <ASIN>0747581088</ASIN>
     <ItemAttributes>
      <Author>J.K. Rowling</Author>
     </ItemAttributes>
   </Item>
.....


Here is what i would like
................ (the same beginning)
<item>
<itemAttributes>
<asin></asin>
.....

Right so here is as far as i have got.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:amazon="http://webservices.amazon.com/AWSECommerceService/2005-01-
19"
    xmlns="http://webservices.amazon.com/AWSECommerceService/2005-01-19">
    
    <xsl:namespace-alias stylesheet-prefix="amazon"
result-prefix="#default"/>
 
   <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template
match="/ItemSearchResponse/amazon:Items/amazon:Item/amazon:ItemAttributes">
    <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        <asin><xsl:value-of select="parent::amazon:ASIN"/></asin>
        </xsl:copy>
    </xsl:template>

</xsl:stylesheet>

so i have all the other elements, and i have entered the item attributes
node, and im trying to copy an element from above.

once i have done this, i need to delete the original from the above node.

please help me im stuck

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.