BSA + New Wiki = No Good

Christian Lohmaier lohmaier+libreoffice at googlemail.com
Fri Oct 19 06:22:38 PDT 2012


Hi *,

On Fri, Oct 19, 2012 at 12:25 PM, Christian Lohmaier
<lohmaier+libreoffice at googlemail.com> wrote:
> [...]
> The additional html tags in the wiki-output on the <html> tag makes
> the removal of the xmlns tag that is added by tidy fail.
>
> i.e.  perl -pe 's|xmlns="http://www.w3.org/1999/xhtml"||'  does
> nothing, since it is not
> <html .. xmlns="http://www.w3.org/1999/xhtml" ..> but
>
> <html ... xmlns=<newline/>
> "http://www.w3.org/1999/xhtml">
>
> so remove the xmlns declaration and just run the xslt commands
> manually or fix the regular expression or something like that.

Or better - instead of trying to search and replace, also use xslt to
process the xml:

stripnamespace.xsl:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output indent="yes"  encoding="UTF-8" method="xml"
omit-xml-declaration="yes"/>

        <xsl:template match="*">
                <xsl:element name="{name()}">
                        <xsl:apply-templates select="node()|@*"/>
                </xsl:element>
        </xsl:template>

        <xsl:template match="@*">
                <xsl:copy/>
        </xsl:template>
</xsl:stylesheet>


--- a/bug/Makefile
+++ b/bug/Makefile
@@ -18,7 +18,8 @@ all: extract compose

 extract:
        mkdir -p build
-       curl --silent
http://wiki.documentfoundation.org/BugReport_Details | tidy
--numeric-entities yes -asxhtml 2>/dev/null | perl -pe
's|xmlns="http://www.w3.org/1999/xhtml"||' >
build/BugReport_Details.xhtml
+       curl --silent
http://wiki.documentfoundation.org/BugReport_Details | tidy
--numeric-entities yes -asxhtml 2>/dev/null > build/tidyout.xhtml ||
echo "ignoring tidy error"
+       xsltproc --encoding UTF-8 --novalid stripnamespace.xsl
build/tidyout.xhtml > build/BugReport_Details.xhtml
        xsltproc --encoding UTF-8 --novalid component_comments.xsl
build/BugReport_Details.xhtml > build/component_comments.xhtml
        xsltproc --encoding UTF-8 --novalid subcomponents.xsl
build/BugReport_Details.xhtml > build/subcomponents.xhtml
        xsltproc --encoding UTF-8 --novalid components.xsl
build/BugReport_Details.xhtml > build/components.xhtml


ciao
Christian


More information about the LibreOffice mailing list