RE: [xsl] Copying nodes

Subject: RE: [xsl] Copying nodes
From: Juan Carlos Gonzalez <jcgonz@xxxxxxxxx>
Date: Tue, 10 Dec 2002 13:46:10 -0800 (PST)
I'm transforming on the server, using MSXML 3.0.

This is my stylesheet:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; >
<xsl:output method="html"/>

<xsl:template match="/">
  <xsl:apply-templates select="/Products/npc"/>
</xsl:template>

<xsl:template match="npc">
  <xsl:copy>
    <xsl:apply-templates select="@*"/> 
    <xsl:copy-of select="*"/>
  </xsl:copy>		
</xsl:template>

<xsl:template match="@*">
  <xsl:copy-of select="."/>
</xsl:template>

<xsl:template match="@URL">
   <xsl:attribute
name="URL">http://www.mydomain.com</xsl:attribute>
<!--	            or
	<xsl:copy>http://www.mydomain.com</xsl:copy>
-->
</xsl:template>

</xsl:stylesheet>

Source file:

<Products>
<npc CatId="01" Descr="Accessories">
<p Price="5.61" Sku="C45-4022" ManfPartNo="4502"
URL="http://www.xxx.com/item.asp?sku=C45-4022"; />
<p Price="9.99" Sku="I30-1032" ManfPartNo="6333"
URL="http://www.xxx.com/item.asp?sku=I30-1032"/> 
</npc>
</Products>

I just want to replace once I copy the content of the
URL attribute.

Thanks again.


 
--- Michael Kay <michael.h.kay@xxxxxxxxxxxx> wrote:
> > 
> > The code that you sent me did not change the value
> of
> > the URL attribute within the copied node. Any
> other suggestions?
> 
> Please post your complete stylesheet and source
> document, tell us what
> processor you are using, and show us the results you
> are getting.
> 
> This code is correct, so either you are running it
> incorrectly, or you
> are using a duff processor.
> 
> Michael Kay
> 
> > 
> > --- Americo_Albuquerque
> > <aalbuquerque@xxxxxxxxxxxxxxxx> wrote:
> > > Hi.
> > > I don't know what you trying to do but try this,
> it
> > > will copy everything
> > > and will change your attribute:
> > > 
> > > <xsl:template match="categ">
> > >   <xsl:copy>
> > >     <xsl:apply-templates select="@*"/> 
> > >     <xsl:copy-of select="*"/>
> > >   </xsl:copy>		
> > > </xsl:template>
> > > 
> > > <xsl:template match="@*">
> > >   <xsl:copy-of select="."/>
> > > </xsl:template>
> > > 
> > > <xsl:template match="@URL">  
> > > <xsl:copy>http://www.mydomain.com</xsl:copy>
> > > </xsl:template>
> > > 
> > > 
> > > -----Original Message-----
> > > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]
> On
> > > Behalf Of Juan Carlos
> > > Gonzalez
> > > Sent: terca-feira, 10 de Dezembro de 2002 18:11
> > > To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> > > Subject: RE: [xsl] Copying nodes
> > > 
> > > 
> > > I'm sorry but still doesn not work.
> > > 
> > > -----Original Message-----
> > > From: Americo Albuquerque
> [mailto:aalbuquerque@xxxxxxxxxxxxxxxx]
> > > Sent: Tuesday, December 10, 2002 11:42 AM
> > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > Subject: RE: [xsl] Copying nodes
> > > 
> > > 
> > > Hi.
> > > Use:
> > > <xsl:template match="@URL"> 
> > > <xsl:copy>http://www.mydomain.com</xsl:copy>
> > > </xsl:template>
> > > 
> > > Hope that this helps
> > > 
> > > -----Original Message-----
> > > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]
> On
> > > Behalf Of Juan Carlos
> > > Gonzalez
> > > Sent: terca-feira, 10 de Dezembro de 2002 14:44
> > > To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> > > Subject: [xsl] Copying nodes
> > > 
> > > 
> > > Hi:
> > > 
> > > I have the following templates for copying nodes
> and
> > > it's attributes which work OK:
> > > 
> > > <xsl:template match="/">
> > >   <xsl:apply-templates select="/root/categ"/>
> > > </xsl:template>
> > > 
> > > <xsl:template match="categ|@*">
> > >   <xsl:copy>
> > >     <xsl:apply-templates select="@*"/> 
> > >     <xsl:copy-of select="*"/>
> > >   </xsl:copy>		
> > > </xsl:template>
> > > 
> > > What I'm trying to do is to change the value for
> a
> > > specific attribute, for that purpose I have
> created
> > > another template but it doesn't seem to execute
> at
> > > all:
> > > 
> > > <xsl:template match="@URL">
> > >    http://www.mydomain.com
> > > <!-- or 
> > >     <xsl:copy-of
> select="http://www.mydomain.com"/>
> > > -->  
> > > </xsl:template>
> > >  
> > > Thanks.
> > > 
> > > 
> > > 
> > >
> __________________________________________________
> > > Do you Yahoo!?
> > > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > > now.
> > > http://mailplus.yahoo.com
> > > 
> > >  XSL-List info and archive:
> > > http://www.mulberrytech.com/xsl/xsl-list
> > > 
> > > 
> > >  XSL-List info and archive:
> > > http://www.mulberrytech.com/xsl/xsl-list
> > > 
> > 
> > 
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> > http://mailplus.yahoo.com
> > 
> >  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> > 
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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


Current Thread