| 
			
			 | 
		#1 | 
| 
			
			
			
			 The Leprechaun 
			
			![]() Posts: 8 
				Karma: 10 
				Join Date: Feb 2015 
				Location: Chapel Hill, NC 
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
			
			 
				
				XPath Expression Coding
			 
			
			
			I am trying to do a code for xpath in calibre that will make an images be content in the table of contents with a "name" but not the image because my ebook is a jpeg.doc in its content. Does anyone know the code which will work that? My images go something like this. My image file for page five is image-5. jpeg. Page six, image-6.jpeg and so on. Would anyone like to take a crack at this. After I get the new name for each file then I want to make that name a link from the TOC to its page. It is a little to challenging for someone who has had only a few programming classes and definitely not one in XPath Expressions.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 Well trained by Cats 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,267 
				Karma: 61916422 
				Join Date: Aug 2009 
				Location: The Central Coast of California 
				
				
				Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Craaack   
		
	
		
		
		
		
		
		
		
		
		
		
	
	![]() A Naked image   ![]() Images should be place upon a page(s) using a H#/Div/P tag You index (List of Illustrations or Figures section) locations on pages Some things are best done with the editor (and a little TOC generator hand work) If you choose to use the automated tool: You should locate the Paragraph with the image (img) tag and make it a H# tag if you add to the <h3 title="foo on a stick"> that will be the label in the TOC The TOC edit (the white block with a T) allows lots of additional options, including a Move (this only affects the index, not the file view order) eg. List of illustrations Map 1 
		Map 2 Foo on a Stick  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#3 | 
| 
			
			
			
			 The Leprechaun 
			
			![]() Posts: 8 
				Karma: 10 
				Join Date: Feb 2015 
				Location: Chapel Hill, NC 
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I will give it a try.  Thank you for your input.  If anyone else has other ideas let me know.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 The Leprechaun 
			
			![]() Posts: 8 
				Karma: 10 
				Join Date: Feb 2015 
				Location: Chapel Hill, NC 
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Didn't work the first time.  Calibre does its own structuring of XPath.  I will try it a few different ways when I get a little more of a chance.  I'm having two days off and I am not going to waste them.  Probably on Wednesday night I try again.  If anyone else has any thoughts feel free to write.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#5 | |
| 
			
			
			
			 Well trained by Cats 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,267 
				Karma: 61916422 
				Join Date: Aug 2009 
				Location: The Central Coast of California 
				
				
				Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 In the Editor S&R, it is just REGEX It is easy to get which searches twisted FWIW I only use code view to make my TOC, so I can't further help with the XPATH  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#6 | |
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,090 
				Karma: 447222 
				Join Date: Jan 2009 
				Location: Valley Forge, PA, USA 
				
				
				Device: Kindle Paperwhite 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I always do like theducks says ... 
		
	
		
		
			Quote: 
	
 and make the TOC using [Generate TOC Using Major Headings] instead of XPath The ...title=" " shows in the TOC but not the image IMHO it's just easier that way, but then again I never do anything complicated either  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
    
| Tags | 
| coding, images, links, table of contents, xpath | 
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Xpath Expression list | JimLL | Conversion | 4 | 04-08-2012 03:29 PM | 
| Xpath expression for detecting chapter marks | p3aul | Calibre | 5 | 11-15-2010 12:14 AM | 
| Xpath TOC Expression | Agama | Calibre | 2 | 07-12-2010 03:24 AM | 
| XPath Expression wizard?? | tonyx3 | Calibre | 1 | 01-26-2010 05:49 AM | 
| XPath Expression Wizard Error | Crusader | Calibre | 4 | 12-27-2009 01:09 PM |