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

RE: Can attribute names be compared !!

Subject: RE: Can attribute names be compared !!
From: Dipesh Khakhkhar <dkhakhkh@xxxxxxxxxxxxxxx>
Date: Wed, 27 Aug 2003 22:37:19 -0400
compare node attributes xsl
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(@*) &lt;= 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


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.