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

From: "Daniel P. Berrange" <berrange@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

On 05/03/2013 09:59 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@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
Alas, the website is still in reduced functionality, as you lost the automated table-of-contents that each page used to have, with nice jump points to the headers located within a page. And I don't know how to fix that. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Fri, May 03, 2013 at 10:51:48AM -0600, Eric Blake wrote:
On 05/03/2013 09:59 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@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
Alas, the website is still in reduced functionality, as you lost the automated table-of-contents that each page used to have, with nice jump points to the headers located within a page. And I don't know how to fix that.
Are you sure. The automated toc works on the pages I've looked at eg http://libvirt.org/migration.html http://libvirt.org/uri.html can you show me some pages which are broken ? Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 05/03/2013 12:16 PM, Daniel P. Berrange wrote:
On Fri, May 03, 2013 at 10:51:48AM -0600, Eric Blake wrote:
On 05/03/2013 09:59 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@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
Alas, the website is still in reduced functionality, as you lost the automated table-of-contents that each page used to have, with nice jump points to the headers located within a page. And I don't know how to fix that.
Are you sure. The automated toc works on the pages I've looked at eg
http://libvirt.org/migration.html http://libvirt.org/uri.html
can you show me some pages which are broken ?
http://libvirt.org/formatdomain.html right now has only two elements in the ToC (just the <h2> headers); it used to have more than 20 links (all the <h3> and <h4>); and I'm used to linking into some of those lower-level headers when trying to guide someone on IRC to a particular section (for example, grabbing a link to formatdomain.html#elementsBIOS was a lot easier by right-click copy the URL from the "BIOS bootloader" link in the ToC). -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Fri, May 03, 2013 at 01:26:20PM -0600, Eric Blake wrote:
On 05/03/2013 12:16 PM, Daniel P. Berrange wrote:
On Fri, May 03, 2013 at 10:51:48AM -0600, Eric Blake wrote:
On 05/03/2013 09:59 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@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
Alas, the website is still in reduced functionality, as you lost the automated table-of-contents that each page used to have, with nice jump points to the headers located within a page. And I don't know how to fix that.
Are you sure. The automated toc works on the pages I've looked at eg
http://libvirt.org/migration.html http://libvirt.org/uri.html
can you show me some pages which are broken ?
http://libvirt.org/formatdomain.html right now has only two elements in the ToC (just the <h2> headers); it used to have more than 20 links (all the <h3> and <h4>); and I'm used to linking into some of those lower-level headers when trying to guide someone on IRC to a particular section (for example, grabbing a link to formatdomain.html#elementsBIOS was a lot easier by right-click copy the URL from the "BIOS bootloader" link in the ToC).
Presuambly you noticed that I pushed a fix for this problem commit b1434b36b14daa9e410cd8293afd386c84ed315d Author: Daniel P. Berrange <berrange@redhat.com> Date: Fri May 3 20:56:04 2013 +0100 Fix a few more docs XSL bugs related to the TOC Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Fri, May 03, 2013 at 04:59:13PM +0100, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@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(-)
This commit breaks the doc generation, as a result http://www.libvirt.org/html/libvirt-libvirt.html is empty.
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">
I suspects that exclude-result-prefixes shoudl not add html there, and that's the problem. Run: xsltproc --nonet -o . ./newapi.xsl libvirt-api.xml in docs before and after the commit, html/libvirt-libvirt.html just gets the navigation bar as a result. I didn't managed yet to find the problem and running with the -v logs more than 60MB of output ... Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard@redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/

On Tue, May 07, 2013 at 09:26:04AM +0800, Daniel Veillard wrote:
On Fri, May 03, 2013 at 04:59:13PM +0100, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@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(-)
This commit breaks the doc generation, as a result http://www.libvirt.org/html/libvirt-libvirt.html is empty.
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">
I suspects that exclude-result-prefixes shoudl not add html there, and that's the problem. Run: xsltproc --nonet -o . ./newapi.xsl libvirt-api.xml
in docs before and after the commit, html/libvirt-libvirt.html just gets the navigation bar as a result. I didn't managed yet to find the problem and running with the -v logs more than 60MB of output ...
The problem was the newapi.xsl file was not declaring the HTML namespace as the default. So the XML it produced was then not getting matched by the rules in page.xsl which now assume a HTML5 namespace. I've pushed the fix for it. Sorry for screwing up the website over the weekend Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Tue, May 07, 2013 at 11:21:45AM +0100, Daniel P. Berrange wrote:
On Tue, May 07, 2013 at 09:26:04AM +0800, Daniel Veillard wrote:
On Fri, May 03, 2013 at 04:59:13PM +0100, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@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(-)
This commit breaks the doc generation, as a result http://www.libvirt.org/html/libvirt-libvirt.html is empty.
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">
I suspects that exclude-result-prefixes shoudl not add html there, and that's the problem. Run: xsltproc --nonet -o . ./newapi.xsl libvirt-api.xml
in docs before and after the commit, html/libvirt-libvirt.html just gets the navigation bar as a result. I didn't managed yet to find the problem and running with the -v logs more than 60MB of output ...
The problem was the newapi.xsl file was not declaring the HTML namespace as the default. So the XML it produced was then not getting matched by the rules in page.xsl which now assume a HTML5 namespace. I've pushed the fix for it.
Ah, thanks for sorting this out !
Sorry for screwing up the website over the weekend
Well, the good point is that the issue was raised quickly as a result :-) Daniel -- Daniel Veillard | Open Source and Standards, Red Hat veillard@redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Eric Blake