Login  Register

Re: Re: Re: XPointer and attributes with namespace

Posted by Alessandro Vernet on Jan 19, 2010; 3:32am
URL: https://discuss.orbeon.com/XPointer-and-attributes-with-namespace-tp1011376p1017240.html

I see, indeed this is a bug with the XPointer implementation. Instead
of using XPointer, you can use XSLT for this, as follows:

    <p:processor name="oxf:xslt">
        <p:input name="data" href="#data"/>
        <p:input name="config">
            <xsl:stylesheet version="2.0">
                <xsl:template match="/">
                    <xsl:copy-of select="/root/configuration"/>
                </xsl:template>
            </xsl:stylesheet>
        </p:input>
        <p:output name="data" id="subset"/>
    </p:processor>

Alex

On Fri, Jan 15, 2010 at 1:21 AM, jpereza <[hidden email]> wrote:

>
> The error is still there, but I don't know if you already noted it.
>
> I'll try to explain myself:
>
> In the input XML I have some elements named "cfg:include" and some
> attributes named "cfg:include-url". The namespace "cfg" is being declared on
> the root element.
>
> When I run the XPL and apply the XPointer expression, the result is a
> fragment of the input XML. In this fragment I still have elements named
> "cfg:include" and attributes named "cfg:include-url", but the namespace
> declaration was left behind in the root element of the input XML.
>
> What the Orbeon's engine is doing to insert the missing namespace
> declaration is, when an element with namespace is found, it inserts the
> namespace declaration on that element.
> But when an attribute with namespace is found, the engine is missing to
> insert the namespace declaration.
>
> Another simpler example:
>
> Input XML:
> <root xmlns:cfg="http://rigel/configuration/XMLInclude">
>        <configuration>
>                <manager>
>                        <data cfg:include-url="some-url" />
>                </manager>
>                <cfg:include url="some-url" />
>        </configuration>
> </root>
>
> XPL:
> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
>          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>          xmlns:oxf="http://www.orbeon.com/oxf/processors">
>
>    <p:param name="data" type="input"/>
>    <p:param name="data" type="output"/>
>
>        <p:processor name="oxf:identity">
>                <p:input name="data"
>                        href="#data#xpointer(/root/configuration)" />
>                <p:output name="data" ref="data" />
>        </p:processor>
>
> </p:config>
>
> Output XML:
> <configuration>
>    <manager>
>        <data cfg:include-url="some-url"/>
>    </manager>
>    <cfg:include url="some-url"
> xmlns:cfg="http://rigel/configuration/XMLInclude"/>
> </configuration>
>
> As you can see, the attribute "cfg:include-url" from element
> "/configuration/manager/data" is missing its namespace declaration. This is
> the error.
>
> I hope is clearer now.
>
> Thanks,
> jpereza
>
>
>
> Alessandro  Vernet wrote:
>>
>> I am not sure to get it. I am running this, and indeed get the same
>> result you do (and no error). See:
>> http://img.skitch.com/20100115-bng52g6e2ynnbshwak9wtwqh41.png
>>
>> This does not reproduce the error mentioned in your first message,
>> right? Do you expected another result when running the in XPL sandbox?
>>
>> Alex
>>
>
> --
> View this message in context: http://n4.nabble.com/XPointer-and-attributes-with-namespace-tp1011376p1014619.html
> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet