I can’t figure out how to select the first child of a grandparent.
Simple structure:
<root>
<front>
<div>
<head>a</head>
<head>1</head>
</div>
<div>
<head>b</head>
<head>2</head>
</div>
</front>
<body>
<div>
<head>c</head>
<head>3</head>
</div>
<div>
<head>d</head>
<head>4</head>
</div>
</body>
<back>
<div>
<head>e</head>
<head>5</head>
</div>
<div>
<head>f</head>
<head>6</head>
</div>
</back>
</root>
How to select head e with the help of axes? I need that for testing inside an XSLT stylesheet, hence the emphasis on axes.
The selection //head[parent::*[self::div]][1][ancestor::back]
doesn’t work, it still selects both, e and f.