[xsl] following-sibling question

Subject: [xsl] following-sibling question
From: "Ken Tam" <kentam@xxxxxxxxxxxxxxx>
Date: Fri, 21 Dec 2007 21:48:03 -0800
Hi all,

I have the following XML sample data:

<items>
  <item id="a"/>
  <item id="b"/>
  <item id="c"/>
  <item id="d"/>
  <item id="e"/>
  <item id="f"/>
</items>

and a search requirement to select nodes starting with id="a" passing id="c"
with anything in between and ending in "f" but must not pass through "d".
Thus, the above sample is not a match. Here is a sample that is a match:

<items>
  <item id="a"/>
  <item id="b"/>
  <item id="b"/>
  <item id="e"/>
  <item id="c"/>
  <item id="e"/>
  <item id="f"/>
</items>

I am not sure how to write the XPATH expression to filter on the "must not
pass through "d" requirement. For example,

/items/item[@id="a"]/following-sibling::item[@id="c"]/following-sibling::ite
m[@id != "d"]/following-sibling::item[@id="f"]

doesn't work as "e" is picked up.

Thanks,
Ken

Current Thread