Unable to pass parameter to custom XBL component

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

Unable to pass parameter to custom XBL component

sandraokeeffe
This post was updated on .
I feel what I'm trying to do should be very simple and i'm missing some key
detail.

The xbl component is invoked like so

<fr:accordionEx >

            <fr:readOnlyInstance
ref="instance('xxxx')/renderParams/readonly" />

           ......
</fr:accordionEx>


and then in the component I set a variable like this

<xforms:group xbl:attr="model context ref bind" xxbl:scope="outer">

                        <xsl:variable name="readOnlyInstance" as="xs:string"
select=".//fr:readOnlyInstance/@ref" />

                       
                        <xsl:value-of select="$readOnlyInstance" />

                        ............
</xforms:group>

However, the value output is the literal value *
instance('xxxx')/renderParams/readonly* and not the evaluated expression.
Is there something I'm missing here?

Thanks in advance,
Sandra

Reply | Threaded
Open this post in threaded view
|

Re: Unable to pass parameter to custom XBL component

Alessandro Vernet
Administrator
Hi Sandra,

First, your message didn't make it to the mailing list (and I just see it by chance here on Nabble—well, not really by chance: Erik brought my attention to it). So you might want to check that the email you are using on Nabble is indeed subscribed to the mailing list.

Regarding your question, think of XSLT as something that runs only once, when your page is produced. You use it in XBL to produce XForms, and XSLT has no visibility on instances. When you say:

    <xsl:variable name="readOnlyInstance" as="xs:string" select=".//fr:readOnlyInstance/@ref" />

You have an XSLT variable that contains the string instance('xxxx')/renderParams/readonly. So far so good. Then, you have:

    <xsl:value-of select="$readOnlyInstance" />

So this will just print that string ("instance('xxxx')/renderParams/readonly"), not evaluate it. You might be tempted to write:

    <xsl:value-of select="saxon:evaluate($readOnlyInstance)" />

Which wouldn't be right, as XSLT has no idea what that instance('xxxx') is. So you need to use XForms there, as in:

    <xforms:output value="{$readOnlyInstance}"/>

The AVT is for XSLT to place in the value attribute the content of the string $readOnlyInstance. The output of the XSLT will look like:

    <xforms:output value="instance('xxxx')/renderParams/readonly"/> 

And this is something that the XForms engine will evaluate.

Alex

sandraokeeffe wrote
I feel what I'm trying to do should be very simple and i'm missing some key
detail.

The xbl component is invoked like so

<fr:accordionEx >

            <fr:readOnlyInstance
ref="instance('xxxx')/renderParams/readonly" />

           ......
</fr:accordionEx>


and then in the component I set a variable like this

<xforms:group xbl:attr="model context ref bind" xxbl:scope="outer">

                        <xsl:variable name="readOnlyInstance" as="xs:string"
select=".//fr:readOnlyInstance/@ref" />

                        <!-- just for troubleshooting -->
                        <xsl:value-of select="$readOnlyInstance" />

                        ............
</xforms:group>

However, the value output is the literal value *
instance('xxxx')/renderParams/readonly* and not the evaluated expression.
Is there something I'm missing here?

Thanks in advance,
Sandra

------------------------------
Sandra O'Keeffe
Software Engineer
rivetlogic <http://www.rivetlogic.com/>Voice+1.781.916.8593Skype
sandra.okeeffe_rivetlogicGTalksokeeffe@rivetlogic.comCalendarsandra
o'keeffe's calendar<http://www.google.com/calendar/hosted/rivetlogic.com/embed?src=sokeeffe%40rivetlogic.com&ctz=America/New_York>
Reply | Threaded
Open this post in threaded view
|

Re: Unable to pass parameter to custom XBL component

sandraokeeffe
Thanks Alessandro,

I just saw this now.  :)  I obviously forgot to sign up for notifications.

Thanks again,
Sandra