Dynamic XSL and multiple models

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

Dynamic XSL and multiple models

Mike Ahlers
Hi,

I am trying to steer away from the static view into a more dynamic view. However, I understand you can submit a model by having the model attribute set. I wonder, what if I have multiple models?

Can I address these models by some kind of dynamic parameter provided by the xsl or am I forced to aggregate the models into a single model and work from there?

In other words, from:

<page id="list" path-info="/visum-country-data/list" view="list/summary.xhtml"/>

to

<page id="list" path-info="/visum-country-data/list" view="list/summary.xsl"/>

or

<page id="list" path-info="/visum-country-data/list" model="aggregate.xpl" view="list/summary.xsl"/>

While I am still curious to the answer of this, I doubt if this is a good approach, for the models are updated using various triggers.

All I am trying to achieve is to create a dynamic <html:img> tag with an xpath expression for the image location inside a repeater block. If this is supported then I have trouble with the syntax, using the current static view approach...

Any suggestions?
Mike
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic XSL and multiple models

Hank Ratzesberger

Hi Mike,

Indeed when using xslt, you must aggregate to a single model.

Also, this processing is only done when the page is loaded
the first time.

Note that the default page flow epilogue will process xhtml
files as xsl templates if it finds the xsl namespace declared --
you don't need to name the files xsl, only include
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xsl:version="2.0"

You can address the model in xforms, for example:

<xforms:instance id="test>
   <xi:include href="input:data"/>
<xforms:instance>

[there _may_ be better ways that xinlcude, src="doc('input:data')" ]

Cheers,
Hank

On Jun 24, 2008, at 6:51 AM, Mike Ahlers wrote:

>
> Hi,
>
> I am trying to steer away from the static view into a more dynamic  
> view.
> However, I understand you can submit a model by having the model  
> attribute
> set. I wonder, what if I have multiple models?
>
> Can I address these models by some kind of dynamic parameter  
> provided by the
> xsl or am I forced to aggregate the models into a single model and  
> work from
> there?
>
> In other words, from:
>
> <page id="list" path-info="/visum-country-data/list"
> view="list/summary.xhtml"/>
>
> to
>
> <page id="list" path-info="/visum-country-data/list"
> view="list/summary.xsl"/>
>
> or
>
> <page id="list" path-info="/visum-country-data/list"  
> model="aggregate.xpl"
> view="list/summary.xsl"/>
>
> While I am still curious to the answer of this, I doubt if this is  
> a good
> approach, for the models are updated using various triggers.
>
> All I am trying to achieve is to create a dynamic <html:img> tag  
> with an
> xpath expression for the image location inside a repeater block. If  
> this is
> supported then I have trouble with the syntax, using the current  
> static view
> approach...
>
> Any suggestions?
> Mike
> --
> View this message in context: http://www.nabble.com/Dynamic-XSL-and- 
> multiple-models-tp18091485p18091485.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
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
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
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic XSL and multiple models

Mike Ahlers
Hi Hank,

Thanks for the feedback, you confirm what I already suspected. I am still in the learning curve of Orbeon and discover new tricks each time. I think I've found a way of addressing my problem, namely I can use variables in xform just like in xsl. But I can probably do without them even, for I saw an example (xforms controls - autocomplete) that fits my needs:

<xforms:output
    value="for $c in instance('countries-names-instance')/country[name = instance('instance')/country-name] return
        if ($c) then concat('<img', ' src="../apps/xforms-controls/images/flags/', $c/us-code,'-flag.gif"',                            '/>')
        else ''" mediatype="text/html"/>

Now, when I try todo something similar (or exactly the same):

<xforms:output value="<img src='whatever.gif'/>" mediatype="text/html"/>

I always end up with:

Fatal error: The value of attribute "value" associated with an element type "xforms:output" must not contain the '<' character.

How come the example works? What am I missing?

Regards,
Mike
Reply | Threaded
Open this post in threaded view
|

Re: Re: Dynamic XSL and multiple models

Hank Ratzesberger

Mike,

> How come the example works? What am I missing?


You know Erik and Alex -- they like to keep us mystified.

(just joking)

I suspect you are looking at the formatted source and that
the actual source uses the XML safe entities :

&lt; &gt;

and so forth.

Cheers,
Hank


On Jun 24, 2008, at 8:58 AM, Mike Ahlers wrote:

>
> Hi Hank,
>
> Thanks for the feedback, you confirm what I already suspected. I am  
> still in
> the learning curve of Orbeon and discover new tricks each time. I  
> think I've
> found a way of addressing my problem, namely I can use variables in  
> xform
> just like in xsl. But I can probably do without them even, for I  
> saw an
> example (xforms controls - autocomplete) that fits my needs:
>
> <xforms:output
>     value="for $c in instance('countries-names-instance')/country
> [name =
> instance('instance')/country-name] return
>         if ($c) then concat('<img', '
> src="../apps/xforms-controls/images/flags/', $c/us-code,'-flag.gif"',
> '/>')
>         else ''" mediatype="text/html"/>
>
> Now, when I try todo something similar (or exactly the same):
>
> <xforms:output value=" whatever.gif " mediatype="text/html"/>
>
> I always end up with:
>
> Fatal error: The value of attribute "value" associated with an  
> element type
> "xforms:output" must not contain the '<' character.
>
> How come the example works? What am I missing?
>
> Regards,
> Mike
> --
> View this message in context: http://www.nabble.com/Dynamic-XSL-and- 
> multiple-models-tp18091485p18094106.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
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
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
Reply | Threaded
Open this post in threaded view
|

Re: Re: Dynamic XSL and multiple models

Mike Ahlers
Hank,

Yah, I forgot to encode them... should have known better. Thanks though :)

- Mike