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

RE: xsl:copy - change attributes and tag name

Subject: RE: xsl:copy - change attributes and tag name
From: "Matias Woloski" <woloski@xxxxxxxx>
Date: Sat, 6 Apr 2002 18:18:06 -0300
xsl copy change attribute
thanks for your prompt response.
I have applied this new xsl but now there is no output for the child nodes
I mean this is the output right now using
	<tree text="Omint Analisis"></tree>
	<tree text="Swiss Medical Analisis"></tree>

I lost children. Refer to my first post to see the output required,

this is the new xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
<xsl:template match="/">
 <xsl:apply-templates select="TreeData/*[not(@IdRef)]"/>

<xsl:template match="Indice[not(@IdRef)]">
	<xsl:attribute name="text"><xsl:value-of select="@Nombre"/></xsl:attribute>
        <xsl:for-each select="*[@IdRef = current()/@IdIndice]">

<xsl:template match="@*">

thanks again for your help Carsten.

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Carsten Klein
> Sent: sábado, 06 de abril de 2002 17:49
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  xsl:copy - change attributes and tag name
> Hi Matias,
> we dig directly into your questions, no time tolouse =)
> Okay here we go:
>     1)
> : Now I want 3 things:
> : 1. instead of generate <Indice> tags I want to get <tree> tags.
> : So I would get
> Instead of <copy/> you will have to create a suitable template to
> insert a <tree/> element into the output tree, therefore it will be
> the easiest
> to add a new template and thus splitting the template which matches
> all "*|@*":
> <xsl:template match="Indice[not(@IdRef)]">
>     <tree>
>         <!-- add whatever additional attributes you want to include
> on tree element here -->
>         <xsl:for-each select="*[@IdRef = current()/@IdIndice]">
>             <xsl:apply-templates/>
>         <xsl:for-each>
>     </tree>
> </xsl:template>
> <xsl:template match="@*">
>     <xsl:copy/>
> </xsl:template>
>     2)
>         if you like to change nombre attribute to text attribute
>         you should so in the first template, adding a <xsl:attribute
> name="text"><xsl:value-of select="@Nombre"/></<xsl:attribute>
>         before <xsl:apply-templates/>
>     3. you are free to add any attribute you like, as long as you
> keep in mind, that if you create a node in the result tree, not to
>         output any other element, be it CDATA or any other, before
> inserting the attribute node on the element just creates.
>         Therefore you may not use <xsl:attribute/> after the
> <xsl:apply-templates/> in the example above.
> Hope this helps
> best regards
> Carsten
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.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

Current Thread


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.
First Name
Last Name
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.