xsl-list
[Top] [All Lists]

Re: xpath dynamic selection

2004-07-12 19:01:55
I would recommend that you go through one of the many tutorials
available on the web, and perhaps buy a good book. It seems as though
you are grasping at straws with no real foundational understanding of
either XPath or XSLT. I don't say this to be rude, or mean, and I hope
you don't take it that way. It will save you a lot of time and
headaches in the future if you first read a bit about the language
before trying to plunge forward.

Try this search:
http://www.google.com/search?hl=en&ie=UTF-8&q=xsl+tutorial

Once you have a basic grasp of xpath and xsl then this problem will
not seem so difficult.

Here is an XPath expression that does what you want: "../item[alt=$number]"

Good Luck,
Josh

On Mon, 12 Jul 2004 23:57:38 +0200, Wim Lemkens 
<wim(_dot_)lemkens(_at_)tiscali(_dot_)be> wrote:
On Sunday 11 July 2004 16:06, Wim Lemkens wrote:
I have cut the problem down to this:
I have
<usecase>
 <item>
   <alt>1</alt>
 </item>
 <item>
 </item>
 <item>
   <alt>2</alt>
 </item>
 <itemcontainer>
 </itemcontainer>
</usecase>

And I want to select the "item" containing an "alt" with a given number. The
location where I want to use the info is in "itemcontainer".

I tought of something like this:
ancestor::usecase/*/alt[(_at_)number = $number]
where the $number is the number I want to select.
But the value of the number in the alt is not really a attribute. I tried to
put it as an attribute
<xsl:attribute name="number">
 <xsl:apply-templates/>
</xsl:attribute>
That didn't work.

How should I do it?

Thanks,

Wim Lemkens



--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--




<Prev in Thread] Current Thread [Next in Thread>