Re: [xsl] how to test previous node name

Subject: Re: [xsl] how to test previous node name
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Sun, 11 Feb 2007 23:38:40 +0100
Andrew Welch wrote:
On 2/11/07, xslt. new <xslt.new@xxxxxxxxx> wrote:
Hi all:

I have an XML input:

<test1>
<item></item>
<text></text>
<item></item>
</test1>

How do I check if the previous node name for <item> is test1 or text?


select="preceding::*[1][self::item1 or self::text]"

I think (s)he meant (guessing):


select="preceding::*[1][self::text] | parent::test1/*[1][generate-id(.) eq generate-id(current())]"

but the OP is pretty unclear about what he wants (can text node be named test1, can test1 be something else then a parent etc? What is the context node?) and fails to include his own tryouts.

-- Abel

Current Thread