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: Re: quick [but difficult] Xpath Question


[Juan Estevan Madrigal]
>
> I need an XPath statement which will return the first node found in the
> document, where the element's local-name() = 'XX'. The node can be
anywhere
> in the source tree. I've tried all sorts of different statements but they
> either result too many records [ I just need the fist "hit"] or no records
> at all.
>
> I only need the first node, not all the nodes. and the name of the element
> is only known at runtime. This Xpath will be inside an XSLT file which
acts
> as a "find command", displaying the first node found in the document.
>


This should do it, assuming that the desired name is passed in as the
parameter $theName -

//*[local-name()=$theName][1]

Cheers,

Tom P


 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]