First notice that the provided XML is not well-formed!
I assume that intended wellformed XML more or less looks like this:
<table>
<tr>
<td class="data1"><p>1</p></td>
<td class="data1"><p>2</p></td>
<td class="data1"><p>3</p></td>
<td class="data1"><p>4</p></td>
</tr>
<tr>
<td class="data1"><p>5</p></td>
<td class="data1"><p>6</p></td>
<td class="data1"><p>7</p></td>
<td class="data1"><p>8</p></td>
</tr>
</table>
For this XML document here are my answers.
Use:
/*/*/td[position() = 3 or position() = 4]/p
Or, you can use the XPath union operator:
/*/*/td[3]/p | /*/*/td[4]/p
The following is wrong:
/*/*/td[3] [4]/p
This specifies the selection of 4th node of /*/*/td[3]
and will select nothing because /*/*/td[3]
only selects two nodes.
Lastly, here is a transformation that when run demonstrates the result of all XPath expressions above:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<xsl:copy-of select=" /*/*/td[position() = 3 or position() = 4]/p"/>
----------------------
<xsl:copy-of select=" /*/*/td[3]/p | /*/*/td[4]/p"/>
----------------------
<xsl:copy-of select=" /*/*/td[3][4]/p"/>
</xsl:template>
</xsl:stylesheet>