Hi Matthew,

This might be an XSLT thing. I modified the BizDoc example as you mentioned, and I don't get the additional namespace to be listed, even on the first detail page. However, this is not because the namespace is lost, but because the namespaces are listed with:

<xsl:for-each select="/form/document/*/namespace::*">
    <xsl:value-of select="."/>
</xsl:for-each>

With this we are listing the namespace nodes on the root element (the <claim> element). Even though the namespace has been initially declared there, it was moved the <annotation> element, as the namespace is not used on the root element. You will get the expected result if you replace the code above in the XSLT file with:

<xsl:for-each select="distinct-values(for $n in
        /form/document/*//namespace::* return string($n))">
    <p><xsl:value-of select="."/></p>
</xsl:for-each>

Now you might wonder why the namespace declaration was moved. That can happen when the DOM gets manipulated. Usually this is not a problem, even though in our code we try to keep the namespace declarations unmodified (instead of trying to remove them if "we think" they are not used, or moving them if "we think" they are only used in a subset of the whole document).

Alex

PS: I am keeping your full message below so people looking at the mailing list archive on SF.net can still follow the discussion.

Matthew J. Graham wrote:

Hi,

There is definitely a bug somewhere with multiple namespaces; using the bizdoc example, I did the following to show it:

(1) To the end of view-detail-1.xsl and view-detail-2.xsl, append:

<f:xml-source xmlns:f="http://orbeon.org/oxf/xml/formatting";>
  <xsl:for-each select="/form/document/*/namespace::*">
    <xsl:value-of select="."/>
  </xsl:for-each>
  <xsl:copy-of select="/form/document/*"/>
</f:xml-source>

This will show all the namespaces defined and then the 'raw' XML

(2) Add an extra namespace (claim2) and an element (annotation) belonging to it to the schema/claim-schema.xsd:

<xs:schema targetNamespace="http://orbeon.org/oxf/examples/bizdoc/claim";
    xmlns:claim="http://orbeon.org/oxf/examples/bizdoc/claim";
    xmlns:claim2="http://somewhere.com/schema";
    xmlns:xs="http://www.w3.org/2001/XMLSchema";
    elementFormDefault="qualified"
    attributeFormDefault="unqualified">

    <xs:element name="claim">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="annotation" ref="claim2:annotation"/>
                <xs:element name="insured-info">
                    <xs:complexType>
...


(3) Add an extra element belonging to claim2 schema to the empty-instance.xml:

<claim xmlns="http://orbeon.org/oxf/examples/bizdoc/claim";>
    <annotation xmlns="http://somewhere.com/schema"/>
    <insured-info>
...

(4) Add an extra element belonging to claim2 schema to claim1.xml:

<claim xmlns="http://orbeon.org/oxf/examples/bizdoc/claim";
       xmlns:claim2="http:somewhere.com/schema">
    <claim2:annotation>NULL</claim2:annotation>
    <insured-info>
...

(5) Now run the bizdoc example, importing new documents and then viewing the first one (corresponding to claim1.xml):

The XML shown for Detail - Step 1:

http://www.w3.org/XML/1998/namespacehttp://orbeon.org/oxf/examples/ bizdoc/claimhttp:somewhere.com/schema
<claim>
<claim2:annotation xmlns:claim2="http:somewhere.com/schema">NULL</claim2:annotation>
<insured-info>


Both namespaces are picked up and the prefix for the second one shown.

(6) Now goto to Detail - Step  2:

http://www.w3.org/XML/1998/namespacehttp://orbeon.org/oxf/examples/ bizdoc/claim
<claim>
<annotation>NULL</annotation>
<insured-info>


The second namespace has been lost.

(7) Go back to Detail - Step 1:

http://www.w3.org/XML/1998/namespacehttp://orbeon.org/oxf/examples/ bizdoc/claim
<claim>
<annotation>NULL</annotation>
<insured-info>


Again the second namespace is gone.

Hope this clarifies things.

    Cheers,

    Matthew

_______________________________________________
oxf-users mailing list
[EMAIL PROTECTED]
http://mail.orbeon.com/mailman/listinfo/oxf-users




------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click _______________________________________________ orbeon-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/orbeon-user

Reply via email to