[Home] [By Thread] [By Date] [Recent Entries]
On 2/12/07, xslt. new <xslt.new@xxxxxxxxx> wrote:
Thank you for your response. I did try this inside template <item> but it fails to get me the right result. I thought I was answering what you were asking for: How do I check if the previous node name for <item> is test1 or text? ...and not what your example suggested: <test1> <item></item> <text></text> <item></item> </test1>
"the preceding axis contains all nodes that are descendants of the root of the tree in which the context node is found, are not ancestors of the context node, and occur before the context node in document order" If your example was: <root> <test1/> <test1> <item></item> <text></text> <item></item> </test1> </root> or <root> <foo><test1/></foo> <test1> <item></item> <text></text> <item></item> </test1> </root> The reply I gave would give the results you expect - it all depends on how you define the "previous node" for that first <item> child of <test1>. If you define the previous node to mean the parent node, then just add a test using the parent axis: select="parent::test1 or preceding::*[1][self::test1]" (It could well be that you don't want to check the whole preceding axis, just the preceding-sibling axis - its worth figuring that out now based on the examples I've given.)
|

Cart



