[libvirt] [PATCH] Fix docs generator regression in previous commit

Daniel P. Berrange berrange at redhat.com
Fri May 3 15:59:13 UTC 2013


From: "Daniel P. Berrange" <berrange at redhat.com>

The previous commit failed to update the XSL to take account
of fact that in XHTML mode the elements need namespace
prefixes. This caused every web page to be blank!

Pushed as a website breaker fix

---
 docs/drvqemu.html.in |  2 +-
 docs/page.xsl        | 64 +++++++++++++++++++++++++++-------------------------
 docs/site.xsl        |  1 +
 3 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/docs/drvqemu.html.in b/docs/drvqemu.html.in
index 3a5c4df..fee2819 100644
--- a/docs/drvqemu.html.in
+++ b/docs/drvqemu.html.in
@@ -560,6 +560,7 @@ $ virsh domxml-to-native qemu-argv demo.xml
       possible to add an element <code><qemu:commandline></code>
       under <code>driver</code>, with the following sub-elements
       repeated as often as needed:
+    </p>
       <dl>
         <dt><code>qemu:arg</code></dt>
         <dd>Add an additional command-line argument to the qemu
@@ -572,7 +573,6 @@ $ virsh domxml-to-native qemu-argv demo.xml
           pair recorded in the attributes <code>name</code>
           and optional <code>value</code>.</dd>
       </dl>
-    </p>
       <p>Example:</p><pre>
 <domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
   <name>QEmu-fedora-i686</name>
diff --git a/docs/page.xsl b/docs/page.xsl
index bc8ea2a..20e4aa6 100644
--- a/docs/page.xsl
+++ b/docs/page.xsl
@@ -1,14 +1,16 @@
 <?xml version="1.0"?>
 <xsl:stylesheet
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:html="http://www.w3.org/1999/xhtml"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:exsl="http://exslt.org/common"
-  exclude-result-prefixes="xsl exsl"
+  exclude-result-prefixes="xsl exsl html"
   version="1.0">
 
   <!-- The sitemap.html.in page contains the master navigation structure -->
-  <xsl:variable name="sitemap" select="document('sitemap.html.in')/html/body/div[@id='sitemap']"/>
+  <xsl:variable name="sitemap" select="document('sitemap.html.in')/html:html/html:body/html:div[@id='sitemap']"/>
 
-  <xsl:template match="code[@class='docref']" mode="content">
+  <xsl:template match="html:code[@class='docref']" mode="content">
     <xsl:variable name="name"><xsl:value-of select="."/></xsl:variable>
     <a href="html/libvirt-libvirt.html#{$name}"><code><xsl:value-of select="$name"/></code></a>
   </xsl:template>
@@ -20,17 +22,17 @@
   </xsl:template>
 
 
-  <xsl:template match="ul[@id='toc']" mode="content">
+  <xsl:template match="html:ul[@id='toc']" mode="content">
     <xsl:call-template name="toc"/>
   </xsl:template>
 
   <!-- This processes the sitemap to form a context sensitive
        navigation menu for the current page -->
-  <xsl:template match="ul" mode="menu">
+  <xsl:template match="html:ul" mode="menu">
     <xsl:param name="pagename"/>
     <xsl:param name="level"/>
     <ul class="{concat('l', $level)}">
-      <xsl:for-each select="li">
+      <xsl:for-each select="html:li">
         <!-- The extra div tag here works around an IE6 whitespace collapsing problem -->
         <li><div>
           <!-- A menu is active if there is an 'a' tag with
@@ -38,7 +40,7 @@
                or a child menu -->
           <xsl:variable name="class">
             <xsl:choose>
-              <xsl:when test="count(.//a[@href = $pagename]) > 0">
+              <xsl:when test="count(.//html:a[@href = $pagename]) > 0">
                 <xsl:text>active</xsl:text>
               </xsl:when>
               <xsl:otherwise>
@@ -51,21 +53,21 @@
                the immediate 'a' tag has href matching the
                current pagename -->
           <xsl:choose>
-            <xsl:when test="$pagename = a/@href">
-              <span class="{$class}"><xsl:value-of select="a"/></span>
+            <xsl:when test="$pagename = html:a/@href">
+              <span class="{$class}"><xsl:value-of select="html:a"/></span>
             </xsl:when>
-            <xsl:when test="starts-with(a/@href, 'http://wiki.libvirt.org')">
-              <a title="{./span}" class="{$class}" href="{a/@href}"><xsl:value-of select="a"/></a>
+            <xsl:when test="starts-with(html:a/@href, 'http://wiki.libvirt.org')">
+              <a title="{./html:span}" class="{$class}" href="{html:a/@href}"><xsl:value-of select="html:a"/></a>
             </xsl:when>
             <xsl:otherwise>
-              <a title="{./span}" class="{$class}" href="{concat($href_base, a/@href)}"><xsl:value-of select="a"/></a>
+              <a title="{./html:span}" class="{$class}" href="{concat($href_base, html:a/@href)}"><xsl:value-of select="html:a"/></a>
             </xsl:otherwise>
           </xsl:choose>
 
           <!-- A sub-menu should only be expanded it contains
                an 'a' tag with href matching this pagename -->
-          <xsl:if test="count(.//a[@href = $pagename]) > 0">
-            <xsl:apply-templates select="ul" mode="menu">
+          <xsl:if test="count(.//html:a[@href = $pagename]) > 0">
+            <xsl:apply-templates select="html:ul" mode="menu">
               <xsl:with-param name="pagename" select="$pagename"/>
               <xsl:with-param name="level" select="$level + 1"/>
             </xsl:apply-templates>
@@ -77,33 +79,33 @@
 
   <xsl:template name="toc">
     <ul>
-      <xsl:for-each select="/html/body/h2[count(a) = 1]">
+      <xsl:for-each select="/html:html/html:body/html:h2[count(html:a) = 1]">
         <xsl:variable name="thish2" select="."/>
         <li>
-          <a href="#{a/@name}"><xsl:value-of select="a/text()"/></a>
-          <xsl:if test="count(./following-sibling::h3[preceding-sibling::h2[1] = $thish2 and count(a) = 1]) > 0">
+          <a href="#{html:a/@name}"><xsl:value-of select="html:a/text()"/></a>
+          <xsl:if test="count(./following-sibling::h3[preceding-sibling::h2[1] = $thish2 and count(html:a) = 1]) > 0">
             <ul>
-              <xsl:for-each select="./following-sibling::h3[preceding-sibling::h2[1] = $thish2 and count(a) = 1]">
+              <xsl:for-each select="./following-sibling::html:h3[preceding-sibling::html:h2[1] = $thish2 and count(html:a) = 1]">
                 <xsl:variable name="thish3" select="."/>
                 <li>
-                  <a href="#{a/@name}"><xsl:value-of select="a/text()"/></a>
-                  <xsl:if test="count(./following-sibling::h4[preceding-sibling::h3[1] = $thish3 and count(a) = 1]) > 0">
+                  <a href="#{html:a/@name}"><xsl:value-of select="html:a/text()"/></a>
+                  <xsl:if test="count(./following-sibling::html:h4[preceding-sibling::html:h3[1] = $thish3 and count(html:a) = 1]) > 0">
                     <ul>
-                      <xsl:for-each select="./following-sibling::h4[preceding-sibling::h3[1] = $thish3 and count(a) = 1]">
+                      <xsl:for-each select="./following-sibling::html:h4[preceding-sibling::html:h3[1] = $thish3 and count(html:a) = 1]">
                         <xsl:variable name="thish4" select="."/>
                         <li>
-                          <a href="#{a/@name}"><xsl:value-of select="a/text()"/></a>
-                          <xsl:if test="count(./following-sibling::h5[preceding-sibling::h4[1] = $thish4 and count(a) = 1]) > 0">
+                          <a href="#{html:a/@name}"><xsl:value-of select="a/text()"/></a>
+                          <xsl:if test="count(./following-sibling::html:h5[preceding-sibling::html:h4[1] = $thish4 and count(html:a) = 1]) > 0">
                             <ul>
-                              <xsl:for-each select="./following-sibling::h5[preceding-sibling::h4[1] = $thish4 and count(a) = 1]">
+                              <xsl:for-each select="./following-sibling::html:h5[preceding-sibling::html:h4[1] = $thish4 and count(html:a) = 1]">
                                 <xsl:variable name="thish5" select="."/>
                                 <li>
-                                  <a href="#{a/@name}"><xsl:value-of select="a/text()"/></a>
-                                  <xsl:if test="count(./following-sibling::h6[preceding-sibling::h5[1] = $thish5 and count(a) = 1]) > 0">
+                                  <a href="#{html:a/@name}"><xsl:value-of select="a/text()"/></a>
+                                  <xsl:if test="count(./following-sibling::html:h6[preceding-sibling::html:h5[1] = $thish5 and count(html:a) = 1]) > 0">
                                     <ul>
-                                      <xsl:for-each select="./following-sibling::h6[preceding-sibling::h5[1] = $thish5 and count(a) = 1]">
+                                      <xsl:for-each select="./following-sibling::html:h6[preceding-sibling::html:h5[1] = $thish5 and count(html:a) = 1]">
                                         <li>
-                                          <a href="#{a/@name}"><xsl:value-of select="a/text()"/></a>
+                                          <a href="#{html:a/@name}"><xsl:value-of select="html:a/text()"/></a>
                                         </li>
                                       </xsl:for-each>
                                     </ul>
@@ -136,7 +138,7 @@
       <head>
         <link rel="stylesheet" type="text/css" href="{$href_base}main.css"/>
         <link rel="SHORTCUT ICON" href="{$href_base}32favicon.png"/>
-        <title>libvirt: <xsl:value-of select="html/body/h1"/></title>
+        <title>libvirt: <xsl:value-of select="html:html/html:body/html:h1"/></title>
         <meta name="description" content="libvirt, virtualization, virtualization API"/>
       </head>
       <body>
@@ -153,13 +155,13 @@
         </div>
         <div id="body">
           <div id="menu">
-            <xsl:apply-templates select="exsl:node-set($sitemap)/ul" mode="menu">
+            <xsl:apply-templates select="exsl:node-set($sitemap)/html:ul" mode="menu">
               <xsl:with-param name="pagename" select="$pagename"/>
               <xsl:with-param name="level" select="0"/>
             </xsl:apply-templates>
           </div>
           <div id="content">
-            <xsl:apply-templates select="/html/body/*" mode="content"/>
+            <xsl:apply-templates select="/html:html/html:body/*" mode="content"/>
           </div>
         </div>
         <div id="footer">
diff --git a/docs/site.xsl b/docs/site.xsl
index a65c10d..ce354c3 100644
--- a/docs/site.xsl
+++ b/docs/site.xsl
@@ -1,5 +1,6 @@
 <?xml version="1.0"?>
 <xsl:stylesheet
+  xmlns:html="http://www.w3.org/1999/xhtml"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:exsl="http://exslt.org/common"
   exclude-result-prefixes="xsl exsl"
-- 
1.8.1.4




More information about the libvir-list mailing list