RE: Can attribute names be compared !!
Hi Michael, Thanks a lot. Sorry if i was not able to explain my problem clearly. I have asked about , what was your second interpretation. My problem was that only to get the value of the attributes of some node (A) by comparing it with other node's attribute name. And this other node (A (same name i.e. Reference node)) is the node having maximum attributes. So i was trying to compare the names of the attributes of these nodes and if names are same then outputting the value otherwise something else. Thanks a lot. Finally i move one step further in achieving my final output which i described in the thread "Column Header and Column Data". I am grateful to you. Regards, Dipesh Date: Wed, 27 Aug 2003 18:19:13 +0100 From: "Michael Kay" <mhk@xxxxxxxxx> Subject: RE: Can attribute names be compared !! Let me try to understand. You have selected an element which I will call $E. Your first statement of the requirement is: > I want to get data for all the nodes with the same > name but having either less or same no. of attributes as this node That sounds to me like: //*[name() = name($E) and count(@*) <= count($E/@*)] But of course the second part of the test is redundant if $E is the element with the greatest number of attributes. Your restatement of the requirement is completely different: > I want to compare > the names of the attribute with the attribute names of the > reference node and > if they are same then outputting the value for that attribute > otherwise outputting some other text (,or any kind of seperator). This sounds to me like: <xsl:for-each select="@*"> <xsl:choose> <xsl:when test="$E/@*[name()=name(current())]"> <xsl:value-of select="."/> </xsl:when> <xsl:otherwise>...</xsl:otherwise> </ </ With two such different statements of the requirement, it's hard to be sure that I have understood either of them properly. Michael Kay 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