|
Subject: RE: [xsl] Can attribute names be compared !! From: "Michael Kay" <mhk@xxxxxxxxx> Date: Wed, 27 Aug 2003 18:19:13 +0100 |
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
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> Dipesh Khakhkhar
> Sent: 27 August 2003 17:28
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Can attribute names be compared !!
>
>
> Hi,
>
> I asked this question twice or thrice with my xsl and xml
> pasted. But it seems
> that is making my email complicated and thats why i am not
> getting any
> replies.
>
> So i will try to rephrase my problem.
> I found out in a node in the xml having maximum attributes
> and I have stored
> it in the variable. Now if 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 how do i
> get it. I mean i don't know the names of the attributes and 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).
>
> I hope this time my email being short I will get some reply.
>
> Thanks !!
>
> Regards,
> Dipesh
>
>
> 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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Can attribute names be compar, Dipesh Khakhkhar | Thread | RE: [xsl] Can attribute names be co, Dipesh Khakhkhar |
| Re: [xsl] Incrementing a Global var, Jeff Kenton | Date | RE: [xsl] Incrementing a Global var, Michael Kay |
| Month |