Re: [xsl] Move one node in xml down one level

Subject: Re: [xsl] Move one node in xml down one level
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Mon, 7 Feb 2005 07:08:56 -0800 (PST)
I think, if you add another template rule like this
(with empty body) -
<xsl:template match="amazon:ASIN" /> 

the node <ASIN> shall be deleted from the output..

Regards,
Mukul

--- SianMace <sianmace@xxxxxxxxxxx> wrote:

> 
> 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
> 



		
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 

Current Thread