I am fairly new to XSLT and this is my XML:
<projects>
<project>
<number>1</number>
<title>Project X</title>
</project>
<project>
<number>2</number>
<title>Project Y</title>
</project>
<project>
<number>3</number>
<title>Project Z</title>
</project>
</projects>
If I have one project and want to get the sibling that follows it, how can I do that?
This code doesn't seem to work for me:
/projects[title="Project X"]/following-sibling
This is actually a completely XPath question.
Use:
This selects any first following sibling
Project
of anyProject
element that is a child of the top element in the XML document and the string value of at least of one of itstitle
children is the string"Project X"
.XSLT - based verification:
When this transformation is applied on the provided XML document:
the XPath expression is evaluated and the correctly-selected element is copied to the output: