including different parts of an xml instance in the same document

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

including different parts of an xml instance in the same document

NizarK
Hello
I'm a new OPS user and i need some help.

I want to generate the content of an xhtml view page dynamically depending on user input.

For example the user chooses form1 so an instance containing :

<form1>
<instance>
  <document xmlns="">
  <action>Z10</action>
  <ndemand></ndemand>
  <destin></destin>
  </document>
</instance>

<controls>
<xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms">
N demand <xforms:input ref="ndemand">xforms:input>
Destinataire : <xforms:select1 ref="destin" appearance="minimal" class="in20">
                                <xforms:label></xforms:label>
                                <xforms:item>
                                <xforms:label>ABC</xforms:label>        <xforms:value>ABC</xforms:value>
                  </xforms:item>
               </xforms:select1>


</xhtml:p>
</controls>
</form1>


is sent to the page form.xhtml wich contains ( that's what i tried but i didn't work ) :

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>TTN - Tunisie Tradenet</title>
        <link rel="stylesheet" type="text/css" href="images/TTN-Acceuil/style.css"/>
        <xforms:model>
         <xforms:instance
        <xi:include href="input:instance" xpointer="/form1/instance"/>
        </xforms:instance
        </xforms:model>
    </head>
    <body>

<xi:include href="input:instance" xpointer="/form1/controls"/>

</body>
</html>


Don't look at the details because i simplified the example but i need a substitute for the xpointer to insert the two different parts of the input instance in two different location in the xhtml document.
Thank you





--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: including different parts of an xml instance in the same document

Ryan Puddephatt
Hi,
        the @xpointer is not currently supported on xi:include.

I think the best way to do this is to use and XSL Transform to add in the
parts you need, you should be able to put the XSL on the @view of your page
flow entry

Ryan



Ryan Puddephatt
Software Engineer

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP

e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108

 

>-----Original Message-----
>From: [hidden email] [mailto:[hidden email]]
>Sent: 11 November 2006 21:27
>To: [hidden email]
>Subject: [ops-users] including different parts of an xml
>instance in the same document
>
>Hello
>I'm a new OPS user and i need some help.
>
>I want to generate the content of an xhtml view page
>dynamically depending on user input.
>
>For example the user chooses form1 so an instance containing :
>
><form1>
><instance>
>  <document xmlns="">
>  <action>Z10</action>
>  <ndemand></ndemand>
>  <destin></destin>
>  </document>
></instance>
>
><controls>
><xhtml:p xmlns:xhtml="http://www.w3.org/1999/xhtml"
>xmlns:xforms="http://www.w3.org/2002/xforms">
>N demand <xforms:input ref="ndemand">xforms:input>
>Destinataire : <xforms:select1 ref="destin"
>appearance="minimal" class="in20">
>                                <xforms:label></xforms:label>
>                                <xforms:item>
>
><xforms:label>ABC</xforms:label>
>        <xforms:value>ABC</xforms:value>
> </xforms:item>
>               </xforms:select1>
>
>
></xhtml:p>
></controls>
></form1>
>
>
>is sent to the page form.xhtml wich contains ( that's what i
>tried but i didn't work ) :
>
><html xmlns="http://www.w3.org/1999/xhtml">
>    <head>
>        <title>TTN - Tunisie Tradenet</title>
> <link rel="stylesheet" type="text/css"
>href="images/TTN-Acceuil/style.css"/>
>        <xforms:model>
>         <xforms:instance
>        <xi:include href="input:instance" xpointer="/form1/instance"/>
>        </xforms:instance
>        </xforms:model>
>    </head>
>    <body>
>
><xi:include href="input:instance" xpointer="/form1/controls"/>
>
></body>
></html>
>
>
>Don't look at the details because i simplified the example but
>i need a substitute for the xpointer to insert the two
>different parts of the input instance in two different
>location in the xhtml document.
>Thank you
>
>
>
>



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: including different parts of an xml instance in the same document

NizarK
Hello ... can you explain better how can i do that with xsl..

I want to add a control to the page from the instance submitted to the page


For example i have this instance :

<instance>
    <name-control>
       <xforms:input ref="name">....</xforms:input>
    </name-control>
</instance>

and i have this view page :

<body>

.....

<xsl:copy-of select="doc('input:instance')/name-control/*"/>
            <!-- i want name input control here -->
...
</body>

Please give  me a concrete example because i tried something like this but it didn't work
thanks



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: including different parts of an xml instance in the same document

Alessandro  Vernet
Administrator
Hi,

To use XSLT in this case as Ryan suggested:

1) Define the XSLT namespace on the root element
(xmlns:xsl="http://www.w3.org/1999/XSL/Transform")
2) Add on the the root element the attribute xsl:version="2.0"
3) Where you have the XInclude expression, put <xsl:copy-of
select="doc('input:instance')/form1/controls">

But if possible, instead of having the XForms markup in the instance,
I would put it in the page itself. If you have multiple possible
forms, maybe you can switch between forms using an <xforms:switch>? I
can see that what you are doing here makes sense if you are building
some type of "form container", where you can then plug-in different
forms, which definition comes maybe from an XML database or some other
source.

Alex

On 11/13/06, [hidden email] <[hidden email]> wrote:

> Hello ... can you explain better how can i do that with xsl..
>
> I want to add a control to the page from the instance submitted to the page
>
>
> For example i have this instance :
>
> <instance>
>     <name-control>
>        <xforms:input ref="name">....</xforms:input>
>     </name-control>
> </instance>
>
> and i have this view page :
>
> <body>
>
> .....
>
> <xsl:copy-of select="doc('input:instance')/name-control/*"/>
>             <!-- i want name input control here -->
> ...
> </body>
>
> Please give  me a concrete example because i tried something like this but it didn't work
> thanks
>
>
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet