Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 21st, 2005, 05:36 AM
Registered User
 
Join Date: Oct 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default changing the value of attribute name

hi there, I am trying to do the following

<xsl:variable name ="attribute1"
        select = "document($file2)//@ID"/>
<xsl:copy-of
        select="document($file1)//*[@partid=$attribute1]"/>

It is a simple two step process.
1- select all attribues named 'ID' from file 1
2- copy all elements from file2 whose attribute named 'partid' matches any of the attributes of file1.

This is working fine. The only problem is that it is not generic...what I want is that instead of @ID I could do @xxxx and instead of @partid I could do @yyyy. Thus if xxxx is ID it becomes @ID etc
you see when I try to do the following i.e.
@$xxxx it generates error. Any idea

 
Old October 21st, 2005, 06:35 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Replace @XYZ with @*[name()=$param]

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace an attribute with another attribute georgemeng XSLT 8 June 10th, 2008 11:04 AM
changing attribute value in MS word cse.sandeep XSLT 4 June 7th, 2007 05:54 AM
Changing the attribute values in XSLT NEO1976 XSLT 5 May 23rd, 2006 03:53 AM
Access to attribute values from class of attribute jacob C# 1 October 28th, 2005 01:11 PM
changing attribute value in xslt rameshnarayan XSLT 1 August 16th, 2005 08:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.