Index: qhp.cpp
===================================================================
--- qhp.cpp	(revision 833)
+++ qhp.cpp	(working copy)
@@ -189,7 +191,7 @@
 
 void Qhp::addContentsItem(bool /*isDir*/, const char * name, 
                           const char * /*ref*/, const char * file, 
-                          const char * /*anchor*/,bool /* separateIndex */,
+                          const char *anchor, bool /* separateIndex */,
                           bool /* addToNavIndex */,
                           Definition * /*def*/)
 {
@@ -202,7 +204,7 @@
   int diff = m_prevSectionLevel - m_sectionLevel;
 
   handlePrevSection();
-  setPrevSection(name, f, m_sectionLevel);
+  setPrevSection(name, f, anchor, m_sectionLevel);
 
   // Close sections as needed
   for (; diff > 0; diff--)
@@ -254,7 +256,7 @@
   }
   else if (context) // container
   {
-    // <keyword name="Foo" id="Foo" ref="doc.html"/>
+    // <keyword name="Foo" id="Foo" ref="doc.html#Foo"/>
     QCString contRef = context->getOutputFileBase();
     QCString level1  = word ? QCString(word) : context->name();
     QCString ref = makeRef(contRef,sectionAnchor);
@@ -309,7 +311,7 @@
   // We skip "Main Page" as our extra root is pointing to that
   if (!((m_prevSectionLevel==1) && (m_prevSectionTitle==getFullProjectName())))
   {
-    QCString finalRef = makeFileName(m_prevSectionRef);
+    QCString finalRef = makeRef(m_prevSectionBaseName, m_prevSectionAnchor);
 
     const char * const attributes[] =
     { "title", m_prevSectionTitle,
@@ -332,17 +334,19 @@
   clearPrevSection();
 }
 
-void Qhp::setPrevSection(const char * title, const char * ref, int level)
+void Qhp::setPrevSection(const char * title, const char * basename, const char * anchor, int level)
 {
   m_prevSectionTitle = title;
-  m_prevSectionRef   = ref;
+  m_prevSectionBaseName = basename;
+  m_prevSectionAnchor = anchor;
   m_prevSectionLevel = level;
 }
 
 void Qhp::clearPrevSection()
 {
   m_prevSectionTitle.resize(0);
-  m_prevSectionRef.resize(0);
+  m_prevSectionBaseName.resize(0);
+  m_prevSectionAnchor.resize(0);
 }
 
 void Qhp::addFile(const char * fileName)
Index: qhp.h
===================================================================
--- qhp.h	(revision 833)
+++ qhp.h	(working copy)
@@ -47,7 +47,7 @@
   private:
     void handlePrevSection();
     void clearPrevSection();
-    void setPrevSection(const char * title, const char * ref, int level);
+    void setPrevSection(const char * title, const char * basename, const char * anchor, int level);
     void addFile(const char * fileName);
 
     static QCString getFullProjectName();
@@ -58,7 +58,8 @@
     QhpXmlWriter m_files;
 
     QCString m_prevSectionTitle;
-    QCString m_prevSectionRef;
+    QCString m_prevSectionBaseName;
+    QCString m_prevSectionAnchor;
 
     int m_prevSectionLevel;
     int m_sectionLevel;
