xsl-list
[Top] [All Lists]

RE: Special processing for the first process of an element

2004-11-10 07:58:22
I don't seem to be able to use ancestor or preceding sibling to reliably identify the very first encounter of the tag

Well, Peter, that would be because the <result> element containing the text node "First" is 
neither an ancestor nor a sibling of the <result> element containing the text node "Second".

Depending on how large and complex your document is, this may be suitable or 
too expensive to process. You may want to look at the construction of the 
source document to see if it can be better organized.

<xsl:value-of select="//result[1]" />
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     Peter Hickman <peter(_at_)semantico(_dot_)com>
Sent:     Wed, 10 Nov 2004 14:47:47 +0000
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  [xsl] Special processing for the first process of an element

In my xml data I have tags around highlighted search terms and when rendering it to XHTML I want to place a <a name="hit" /> on only the first occurrence of such a tag. The problem is that I don't seem to be able to use ancestor or preceding sibling to reliably identify the very first encounter of the tag. For example:

<p>
   <p>
      <p>
            <result>First</result>
      </p>
   </p>
   <p>
      <result>Second</result>
   </p>
</p>

When processing the tag around the word "Second" I seem to be unable to locate the earlier occurrence around the word "First".

Any ideas?

Thanks.


--+------------------------------------------------------------------
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>