Apache OpenOffice (AOO) Bugzilla – Issue 49392
problem with namespace="" in sx2ml stylesheets
Last modified: 2013-02-07 21:53:19 UTC
Hi Svante, Trying to use sx2ml (from OO2Beta) with libxslt (http://xmlsoft.org/XSLT/) I found out a problem with node-set, which is supported by libxslt, but not with the empty namespaces as in: openoffice.org1.9.95/share/xslt/export/common/styles/style_collector.xsl <xsl:when test="office:document-content"> <xsl:element name="styles-file" namespace=""> ^^^^^^^^^^^^ <xsl:copy-of select="document(concat($sourceBaseURL, 'styles.xml'))" /> </xsl:element> <xsl:element name="meta-file" namespace=""> ^^^^^^^^^^^^ <xsl:copy-of select="document(concat($sourceBaseURL, 'meta.xml'))" /> </xsl:element> </xsl:when> And libxslt miss to recover them with: <xsl:copy-of select="$documentLinks/styles-file/*" /> Indeed, I tested with the following xslt file: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:exslt="http://exslt.org/common" > <xsl:template match="/"> <xsl:variable name="initial"> <xsl:element name="a">text</xsl:element> <b/> </xsl:variable> <xsl:variable name="nodeset" select="exslt:node-set($initial)"/> <out> <xsl:copy-of select="$nodeset/a"/> </out> </xsl:template> </xsl:stylesheet> gives: <?xml version="1.0"?> <out xmlns:exslt="http://exslt.org/common"><a>text</a></out> But modifying <xsl:element name="a">text</xsl:element> to <xsl:element name="a" namespace="">text</xsl:element> gives: <?xml version="1.0"?> <out xmlns:exslt="http://exslt.org/common"/> Do you think that it is necessary to keep the empty namespace attribute in the stylesheets? Best regards, -- Marc-Olivier BERNARD
Confirming this issue, after review of current issue got to select target OOo 2.0.2
The following should be fixed along: > >3. in export/common/body.xsl: > ><xsl:template name="encode-string"> >(...) > ><xsl:otherwise> > <xsl:message terminate="no">ERROR: Function not found: java:java.net.URLEncoder.encode</xsl:message> > <xsl:value-of select="$textToBeEncoded"/> ></xsl:otherwise> > >Thus terminate="no" instead of "yes" and add <xsl:value-of >select="$textToBeEncoded"/> > >I suppose that incoming XML is UTF-8. > Yes, but not the character encoding was meant, more the string encoding. Used for referencing child documents from the content table of a master document by URLs. You won't need it, as the transformation of master documents would work only with Java and is not supported anyway. I will add your proposed change (of 3.) to the exisiting issue and will enhance the comment of <xsl:template name="encode-string"> as well.
Due to heavy workload the work on the XHTML sample filter had to be downgraded in priority.
Created attachment 73647