Re: XSLT + java: namespace problem

Guillon Benoit <[email protected]> Fri, 09 Sep 2005 13:00:21 +0200
Newsgroups gmane.comp.openoffice.devel.xml
Message-ID <[email protected]>
Dear Dave,

Thanks for your reply. The element I want to match is the root element 
of the content.xml file in a sxw document: office:document-content.

In the input file all the namespaces are well declared:

<office:document-content
    xmlns:office="http://openoffice.org/2000/office"
    xmlns:style="http://openoffice.org/2000/style"
    xmlns:text="http://openoffice.org/2000/text"
    xmlns:table="http://openoffice.org/2000/table"
    xmlns:draw="http://openoffice.org/2000/drawing"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:number="http://openoffice.org/2000/datastyle"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns:dr3d="http://openoffice.org/2000/dr3d"
    xmlns:math="http://www.w3.org/1998/Math/MathML"
    xmlns:form="http://openoffice.org/2000/form"
    xmlns:script="http://openoffice.org/2000/script"
    office:class="text" office:version="1.0">

and I declare the one I use in my XSL stylesheet:

<xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:text="http://openoffice.org/2000/text" 
    xmlns:meta="http://openoffice.org/2000/meta"
    xmlns:table="http://openoffice.org/2000/table" 
    xmlns:office="http://openoffice.org/2000/office"
    xmlns:dc="http://purl.org/dc/elements/1.1/" 
    xmlns:draw="http://openoffice.org/2000/drawing"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:style="http://openoffice.org/2000/style"
    version="1.0">

I really think that the problem is not related to the XSL because it 
works fine outside Openoffice, with different . It seems that inside 
Openoffice the parser used to parse my stylesheet or the input file - or 
both - is not namespace aware ... Maybe the problem comes from the 
xmerge bridge ...

Any idea ?

Benoit.

Dave Pawson wrote:

>On 08/09/05, Guillon Benoit <[email protected]> wrote:
>  
>
>>Hello,
>>
>>I'm having troubles with the xmerge framework when I try to export a sxw
>>document using an XSL stylesheet. When I start my Java application
>>outside OpenOffice everything works fine but when I use it as a filter
>>in OOo 1.1.4, the XPATH expressions do not match when I use namespaces
>>but match when I don't use namespaces.
>>
>>Example:
>><xsl:value-of select="count(/document-content/*)"/> will return 0
>>    
>>
>
>  
>
>>It must be a problem of XML parser configuration but I really don't know
>>where I can fix it.
>>    
>>
>
>what namespace is the local-element 'document-content' in?
>Have you declared a namespace prefix for that namespace?
>
>No idea how you do it in java, but it's easy in XSLT.
>
>HTH
>
>
>  
>