evilgenius
New Member
So I created a xsl file to style my toc.ncx. No I do not want to use NSXMLParse. I think it is a problem with the ncx namespace, but I am getting incorrect output.Here is my tableofcontents.xsl===============================================\[code\]<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/" exclude-result-prefixes="ncx"> <xsl:template match="//navMap"> <div id="toc"> <xsl:for-each select="navPoint"> <br /> <div class="option" onClick="GoTo(this)"> <xsl:attribute name="id"> <xsl:value-of select='content[@src]' /> </xsl:attribute> <xsl:value-of select='navLabel/text' /> </div> <xsl:for-each select="navPoint/navPoint"> <br /> <div class="suboption" onClick="GoTo(this)"> <xsl:attribute name="id"> <xsl:value-of select='content[@src]' /> </xsl:attribute> <xsl:value-of select='navLabel/text' /> </div> </xsl:for-each> </xsl:for-each> <br /> </div> </xsl:template></xsl:stylesheet>\[/code\]======================================And here is a sample of a typical toc.ncx\[code\]<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE ncx PUBLIC '-//NISO//DTD ncx 2005-1//EN' 'http://www.daisy.org/z3986/2005/ncx-2005-1.dtd'><?xml-stylesheet type="text/xsl" href="http://stackoverflow.com/questions/15742374/tableofcontents.xsl"?><ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1" xml:lang="en"> <head> <meta content="http://www.gutenberg.org/ebooks/1065" name="dtb:uid"/> <meta content="2" name="dtb:depth"/> <meta content="Project Gutenberg EPUB-Maker v0.03 by Marcello Perathoner <[email protected]>" name="dtb:generator"/> <meta content="0" name="dtb:totalPageCount"/> <meta content="0" name="dtb:maxPageNumber"/> </head> <docTitle> <text>The Raven</text> </docTitle> <navMap> <navPoint id="np-1" playOrder="1"> <navLabel> <text>The Raven</text> </navLabel> <content src="http://stackoverflow.com/questions/15742374/www.gutenberg.org@files@1065@[email protected]#pgepubid00000"/> </navPoint> <navPoint id="np-2" playOrder="2"> <navLabel> <text>by</text> </navLabel> <content src="http://stackoverflow.com/questions/15742374/www.gutenberg.org@files@1065@[email protected]#pgepubid00001"/> <navPoint id="np-3" playOrder="3"> <navLabel> <text>Edgar Allan Poe</text> </navLabel> <content src="http://stackoverflow.com/questions/15742374/www.gutenberg.org@files@1065@[email protected]#pgepubid00002"/> </navPoint> </navPoint> </navMap></ncx>\[/code\]===================================As you can see it doesn't have a main document element, simply the namespace ncx.How do I fix this to get the output for example:\[code\]<div id="toc"> <br /> <div class="option" onClick="GoTo(this)" id="www.gutenberg.org@files@1065@[email protected]#pgepubid00000"> The Raven </div> <br /> <div class="option" onClick="GoTo(this)" id="www.gutenberg.org@files@1065@[email protected]#pgepubid00001"> by <br /> <div class="suboption" onClick="GoTo(this)" id="www.gutenberg.org@files@1065@[email protected]#pgepubid00002"> Edgar Allan Poe </div> </div> </div>\[/code\]