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

Re: Copying nodes

Subject: Re: Copying nodes
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Wed, 11 Dec 2002 00:06:12 +0100
copying nodes in asp
Hello Juan,

Juan Carlos Gonzalez wrote:
Hi Joerg:

I think I did what you suggested, but still I don't
get the expected results.

Not exactly ;-)


Sorry to keep posting the same question back.
THanks again,
... a frustated newbie on xslt

<xsl:template match="npc">

Change to <xsl:template match="*">.


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


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

Remove the template above.


The rest stays the same.

Joerg

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

--- Joerg Heinicke <joerg.heinicke@xxxxxx> wrote:

Hello Juan,

the error is obviously:

Juan Carlos Gonzalez wrote:

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="*"/>

Here you copy all elements without any processing,
so you never apply templates on @URL. Change it to <xsl:apply-templates
select="*"/> and the the template match to "*". Then it shell work.


Joerg


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


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.