You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by "Ushakov, Sergey N" <us...@int.com.ru> on 2005/04/02 06:02:46 UTC

[?] siblings in a filtered nodeset

Hi, sorry if it is a faq - I still could not find an answer.

XPath spec does not say much about semantics of the term 'sibling'.

Common sense suggests that if we have a filtered nodeset and start fetching
siblings to any node of this nodeset, then all the siblings should belong to
thay nodeset.

With Xalan-J if I get a filtered nodeset and start inspectings siblings, it
seems that siblings are selected with regard of the original document tree
rather than the filtered nodeset.

Is it intended behavior or a bug?

A test case is appended. One might expect that only 'a' nodes should be
listed by 'xsl:message'. But the fact is that a 'b' node is listed also...

Regards,
Sergey


test.xsl
========
<?xml version="1.0" ?>

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  >

  <xsl:output method="xml" />

  <xsl:template match="a">
    <xsl:message>following-sibling: <xsl:value-of
      select="name(following-sibling::*[1])" /></xsl:message>
    </xsl:template>

  <xsl:template match="/">
    <xsl:variable name="filtered-nodeset" select="d/a" />
    <xsl:apply-templates select="$filtered-nodeset" />
    </xsl:template>

  </xsl:stylesheet>


test.xml
========
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<d>
  <a/>
  <a/>
  <b/>
  <a/>
  </d>