[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|