xsl-list
[Top] [All Lists]

Re: [xsl] how to test previous node name

2007-02-11 19:28:15
Hi Andrew:

Thank you for your response. I did try this inside template <item> but
it fails to get me the right result.

This is what I tried:

<xsl:template match="item">
<xsl:if test="preceding::*[1][self::test1]">

<xsl:text>Found test1</xsl:text>
</xsl:if>

</xsl:template>

It is not working.

On 2/11/07, Andrew Welch <andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com> 
wrote:
On 2/11/07, xslt. new <xslt(_dot_)new(_at_)gmail(_dot_)com> 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]"

cheers
andrew

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



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