i have found that different XSLT processors return nodes in the preceding-sibling axis differently. So in some cases the immediately preceding node is: preceding-sibling::node()[1] - but in some other cases this always returns the very first node in document order. In those cases you might want something like preceding-sibling::node()[last()] which takes the "last" of the preceiding-sibling nodes, which is the one immediately prior to the "current" node ... I don't recall which way xalan does it... -Riz ---------------------------------------- Rizwan Virk CTO CambridgeDocs [EMAIL PROTECTED] personal: [EMAIL PROTECTED]
________________________________ From: J.Pietschmann [mailto:[EMAIL PROTECTED] Sent: Fri 12/17/2004 3:59 PM To: [EMAIL PROTECTED] Subject: Re: Xalan preceding-sibling problem [EMAIL PROTECTED] wrote: > I am attempting to compare the values in one node with the preceding node. ... > self::node()[not(text()=preceding-sibling::node()/text())] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This expression will be true if at least one text node child of the context node is equal to at least one text node child of any of the preceding siblings of the context node. If you want to compare to the immediatly preceding sibling only, use text()=preceding-sibling::node()[1]/text() instead. Also this may or may not do what you want if the nodes in question have multiple text node children (may happen if they have mixed content). You'll probably want to use the folllowing form, which compares the string values of the nodes instead of the text node children: .=preceding-sibling::node()[1] Node comparision in XSLT are tricky until you get a grasp on working with sets (somewhat similar to SQL). Note further that this is a pure XSLT question, which would have better been asked on the XSLT list: http://www.mulberrytech.com/xsl/xsl-list/ J.Pietschmann --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
