The XPath language (örneğin DOM API, XSLT, Xquery'nin gibi ...) başka bir dilde gömülü olarak tasarlanmış ve tek başına strong> kullanılamaz. Özgün soru istenen gömme ne olduğunu belirtmiyor.
Below is a very simple and short solution when XPath is embedded in XSLT strong>.
This transformation:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="div[@class='info']">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
when applied on this xml document:
<html>
<body>
<div class="info">
<h1>title1</h1> text1
<a href="somelink1">anchor1</a>
</div>
Something else here
<div class="info">
<h2>title2</h2> text2
<a href="somelink2">anchor2</a>
</div>
Something else here
<div class="info">
<h3>title3</h3> text3
<a href="somelink3">anchor3</a>
</div>
</body>
</html>
produces the wanted result:
<div class="info">
<h1>title1</h1> text1
<a href="somelink1">anchor1</a>
</div>
Something else here
<div class="info">
<h2>title2</h2> text2
<a href="somelink2">anchor2</a>
</div>
Something else here
<div class="info">
<h3>title3</h3> text3
<a href="somelink3">anchor3</a>
</div>