This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: variable in xpath?


Hi Steve,

> with <element> as the context node, how do i select the contents of
> either <a> or <b> using $child from the following fragment?

You need to find the elements and filter them to include only those
(or that one) whose name is the same as the value of $child. You can
filter node sets with a predicate ([]s) and you can find the name of
an element with the name() function. So you need:

  *[name() = $child]

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]