# Dealing with xpath using libxml

**URL:** <https://www.ruby-forum.com/t/dealing-with-xpath-using-libxml/86305>\
**Category:** Ruby\
**Created:** [February 21, 2007, 10:32am UTC](https://www.ruby-forum.com/t/dealing-with-xpath-using-libxml/86305 "2007-02-21T10:32:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bastien-vaucher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ed655f/32.png) [@bastien-vaucher](https://www.ruby-forum.com/u/bastien-vaucher)\
**Post date:** [February 21, 2007, 10:32am UTC](https://www.ruby-forum.com/t/dealing-with-xpath-using-libxml/86305/1 "2007-02-21T10:32:41Z")

</div>

Hi,

I m trying to generate a xslt file from xhtml using libxml and when I m  
parsing the xhtml file and look at xpaths i get something ugly like :

/_/_[2]/\*[1]

I tried to do the same with REXML and i obtained :

/html/body/p

When I m parsing xml files it works fine, but with xhtml files xpaths  
are really ugly.

Does anyone know how to get nicer xpaths with libxml ?

Thanks for your answers
