Thread: XPath query
View Single Post
Old 05-10-2009, 04:46 PM   #1
amjbrown
Addict
amjbrown ought to be getting tired of karma fortunes by now.amjbrown ought to be getting tired of karma fortunes by now.amjbrown ought to be getting tired of karma fortunes by now.amjbrown ought to be getting tired of karma fortunes by now.amjbrown ought to be getting tired of karma fortunes by now.amjbrown ought to be getting tired of karma fortunes by now.amjbrown ought to be getting tired of karma fortunes by now.amjbrown ought to be getting tired of karma fortunes by now.amjbrown ought to be getting tired of karma fortunes by now.amjbrown ought to be getting tired of karma fortunes by now.amjbrown ought to be getting tired of karma fortunes by now.
 
amjbrown's Avatar
 
Posts: 322
Karma: 1231044
Join Date: Feb 2009
Location: London, UK
Device: Kindle Oasis 3, Kindle app on the iPhone
XPath query

I was hoping the group might be able to help me with some trouble I have been having at the very end of my first eBook conversion.

I have a file in Word which has Heading 1, 2 and 3s in it, where Heading 3 is the chapter headings, and I would like a TOC built from them.

The Word file looks perfect, I am using the latest Mac Office suite. I save as rtf, load the rtf file into TextEdit and save as HTML. Everything renders nicely in Safari, so I view the Heading 2 and Heading 3 lines in Text Wrangler to see they are wrapped with:

Code:
<p class="p4">
and

Code:
<p class="p5">
respectively.

I don't do HTML natively, but there are some CSS looking lines at the top, which define something akin to these classes, so I go with it.

The XPath help file has great examples if you are in the <h1> type world, but I try and adapt, and feed the following line in to the right box in the chapter detection dialogue...

Code:
//*[name()='<p class="p4">' or name()='<p class="p5">']
Makes no difference

How stupid am I being, and does anyone have any suggestions as to where I go?

To say I am new to this would be an understatement!

Thanks!

amjb
amjbrown is offline   Reply With Quote