Access 'data' pipeline after setting context to another pipeline.

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

Access 'data' pipeline after setting context to another pipeline.

Daniel E. Renfer
Hello,

This question might be better addressed in the XSLT list, but seeing
as it involves functionality specific to Orbeon Forms, I figured it'd
be best if I asked here first.

I'm trying to write a stylesheet to merge two instances. I'm doing an
apply-templates on the nodes in my second input (the non-default one)
and in my template I'm trying to access a node in my default instance.
The obvious way of accessing the node didn't seem to do the trick,
(//node) neither did trying to call the named input of 'data'
(doc('input:data')//node) and if I tried to do just doc('')//node it
seems like it's searching my stylesheet and not my data.

So, basically my question is, how can I specify that I want to search
the default input when my context is not placed anywhere in that
document?

--
Daniel E. Renfer
http://kronkltd.net/


--
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

access-other-node.xpl (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Access 'data' pipeline after setting context to another pipeline.

Alexander Žaťko
You can use <xsl:with-param name="dataFragemnt" select="." /> in your  
<xsl:apply-templates />. This will allow you to restore context in  
the template where you want to do merging. There you would use  
something like <xsl:value-of select="$dataFragemnt/path/to/desired/
node" />

I am not sure though that you will want to use <xsl:apply-templates  
select="doc('input:alternate')/*">.  In such situations I usually use  
<xsl:call-template /> calling a named template that processes nodes  
of the non-data input.

A.

On Dec 31, 2006, at 2:06 PM, Daniel E. Renfer wrote:

> Hello,
>
> This question might be better addressed in the XSLT list, but seeing
> as it involves functionality specific to Orbeon Forms, I figured it'd
> be best if I asked here first.
>
> I'm trying to write a stylesheet to merge two instances. I'm doing an
> apply-templates on the nodes in my second input (the non-default one)
> and in my template I'm trying to access a node in my default instance.
> The obvious way of accessing the node didn't seem to do the trick,
> (//node) neither did trying to call the named input of 'data'
> (doc('input:data')//node) and if I tried to do just doc('')//node it
> seems like it's searching my stylesheet and not my data.
>
> So, basically my question is, how can I specify that I want to search
> the default input when my context is not placed anywhere in that
> document?
>
> --
> Daniel E. Renfer
> http://kronkltd.net/
> <access-other-node.xpl>
>
> --
> You receive this message as a subscriber of the ops-
> [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



--
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: Access 'data' pipeline after setting context to another pipeline.

Ryan Puddephatt
In reply to this post by Daniel E. Renfer
Daniel,
        Your foo input won't match because it is never applied with apply
templates, add another apply-templates/@select="."/>

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]] On Behalf
>Of Daniel E. Renfer
>Sent: 31 December 2006 13:06
>To: OPS Users
>Subject: [ops-users] Access 'data' pipeline after setting
>context to another pipeline.
>
>Hello,
>
>This question might be better addressed in the XSLT list, but
>seeing as it involves functionality specific to Orbeon Forms,
>I figured it'd be best if I asked here first.
>
>I'm trying to write a stylesheet to merge two instances. I'm
>doing an apply-templates on the nodes in my second input (the
>non-default one) and in my template I'm trying to access a
>node in my default instance.
>The obvious way of accessing the node didn't seem to do the trick,
>(//node) neither did trying to call the named input of 'data'
>(doc('input:data')//node) and if I tried to do just
>doc('')//node it seems like it's searching my stylesheet and
>not my data.
>
>So, basically my question is, how can I specify that I want to
>search the default input when my context is not placed
>anywhere in that document?
>
>--
>Daniel E. Renfer
>http://kronkltd.net/
>



--
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: Access 'data' pipeline after setting context to another pipeline.

Daniel E. Renfer
Thanks Ryan and Alex.

I can't believe I didn't think of passing my main document in as a
parameter. The test xpl I supplied was a very stripped down version of
what I was doing, and doesn't really represent what my actual
stylesheet looks like. I have a reason for wanting to match the nodes
in my second document that wasn't really made apparent in the test doc
I sent.

I was just hoping there was a general way to jump back to the main
input without having to resort to passing as a param. This'll do the
trick though.

On 12/31/06, Ryan Puddephatt <[hidden email]> wrote:

> Daniel,
>         Your foo input won't match because it is never applied with apply
> templates, add another apply-templates/@select="."/>
>
> 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]] On Behalf
> >Of Daniel E. Renfer
> >Sent: 31 December 2006 13:06
> >To: OPS Users
> >Subject: [ops-users] Access 'data' pipeline after setting
> >context to another pipeline.
> >
> >Hello,
> >
> >This question might be better addressed in the XSLT list, but
> >seeing as it involves functionality specific to Orbeon Forms,
> >I figured it'd be best if I asked here first.
> >
> >I'm trying to write a stylesheet to merge two instances. I'm
> >doing an apply-templates on the nodes in my second input (the
> >non-default one) and in my template I'm trying to access a
> >node in my default instance.
> >The obvious way of accessing the node didn't seem to do the trick,
> >(//node) neither did trying to call the named input of 'data'
> >(doc('input:data')//node) and if I tried to do just
> >doc('')//node it seems like it's searching my stylesheet and
> >not my data.
> >
> >So, basically my question is, how can I specify that I want to
> >search the default input when my context is not placed
> >anywhere in that document?
> >
> >--
> >Daniel E. Renfer
> >http://kronkltd.net/
--
Daniel E. Renfer
http://kronkltd.net/



--
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: Access 'data' pipeline after setting context to another pipeline.

Ryan Puddephatt
Daniel,
        Not quite sure what you mean here are you passing your main input
twice, once as a data input once as a param? You don't need to do this you
just need to change your apply-templates to
@select="*,doc('input:alternative')/*" to apply both inputs

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]] On Behalf
>Of Daniel E. Renfer
>Sent: 01 January 2007 00:52
>To: [hidden email]
>Subject: Re: [ops-users] Access 'data' pipeline after setting
>context to another pipeline.
>
>Thanks Ryan and Alex.
>
>I can't believe I didn't think of passing my main document in
>as a parameter. The test xpl I supplied was a very stripped
>down version of what I was doing, and doesn't really represent
>what my actual stylesheet looks like. I have a reason for
>wanting to match the nodes in my second document that wasn't
>really made apparent in the test doc I sent.
>
>I was just hoping there was a general way to jump back to the
>main input without having to resort to passing as a param.
>This'll do the trick though.
>
>On 12/31/06, Ryan Puddephatt <[hidden email]> wrote:
>> Daniel,
>>         Your foo input won't match because it is never applied with
>> apply templates, add another apply-templates/@select="."/>
>>
>> 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]] On Behalf Of
>> >Daniel E. Renfer
>> >Sent: 31 December 2006 13:06
>> >To: OPS Users
>> >Subject: [ops-users] Access 'data' pipeline after setting
>context to
>> >another pipeline.
>> >
>> >Hello,
>> >
>> >This question might be better addressed in the XSLT list,
>but seeing
>> >as it involves functionality specific to Orbeon Forms, I
>figured it'd
>> >be best if I asked here first.
>> >
>> >I'm trying to write a stylesheet to merge two instances.
>I'm doing an
>> >apply-templates on the nodes in my second input (the
>non-default one)
>> >and in my template I'm trying to access a node in my default
>> >instance.
>> >The obvious way of accessing the node didn't seem to do the trick,
>> >(//node) neither did trying to call the named input of 'data'
>> >(doc('input:data')//node) and if I tried to do just
>doc('')//node it
>> >seems like it's searching my stylesheet and not my data.
>> >
>> >So, basically my question is, how can I specify that I want
>to search
>> >the default input when my context is not placed anywhere in that
>> >document?
>> >
>> >--
>> >Daniel E. Renfer
>> >http://kronkltd.net/
>
>--
>Daniel E. Renfer
>http://kronkltd.net/
>
>



--
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: Access 'data' pipeline after setting context to another pipeline.

Daniel E. Renfer-2
Ryan,

I don't think you quite caught the drift of what I was trying to
achieve. (My fault, I made my example way too simplistic.) I have two
inputs. One comes from the instance, and the other is the blank
document I use as my "default submission". Based on which path in my
p:choose I take, I need to run one of several stylesheets to copy
select data from the instance into the template before storing the
resulting document to the session.

At the time, I didn't realize that it would be less than trivial to
"jump back" to the main input after matching an element in the
alternate input. Now that I've had a little more time to think about
it, I'll probably just swap the order of the two inputs and call the
data from the instance by name. That is, unless anyone has a better
suggestion for "jumping back" than Alexander's.

Attached is a slightly more in depth example. I've implemented the
"with-param" trick and this should return the desired results, just
not as elegantly as I had hoped.

Desired result:

<root>
    <a>bar</a>
    <b>foo</b>
    <c>bar</c>
    <d>bar</d>
</root>

On 1/1/07, Ryan Puddephatt <[hidden email]> wrote:

> Daniel,
>         Not quite sure what you mean here are you passing your main input
> twice, once as a data input once as a param? You don't need to do this you
> just need to change your apply-templates to
> @select="*,doc('input:alternative')/*" to apply both inputs
>
> 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]] On Behalf
> >Of Daniel E. Renfer
> >Sent: 01 January 2007 00:52
> >To: [hidden email]
> >Subject: Re: [ops-users] Access 'data' pipeline after setting
> >context to another pipeline.
> >
> >Thanks Ryan and Alex.
> >
> >I can't believe I didn't think of passing my main document in
> >as a parameter. The test xpl I supplied was a very stripped
> >down version of what I was doing, and doesn't really represent
> >what my actual stylesheet looks like. I have a reason for
> >wanting to match the nodes in my second document that wasn't
> >really made apparent in the test doc I sent.
> >
> >I was just hoping there was a general way to jump back to the
> >main input without having to resort to passing as a param.
> >This'll do the trick though.
> >
> >On 12/31/06, Ryan Puddephatt <[hidden email]> wrote:
> >> Daniel,
> >>         Your foo input won't match because it is never applied with
> >> apply templates, add another apply-templates/@select="."/>
> >>
> >> 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]] On Behalf Of
> >> >Daniel E. Renfer
> >> >Sent: 31 December 2006 13:06
> >> >To: OPS Users
> >> >Subject: [ops-users] Access 'data' pipeline after setting
> >context to
> >> >another pipeline.
> >> >
> >> >Hello,
> >> >
> >> >This question might be better addressed in the XSLT list,
> >but seeing
> >> >as it involves functionality specific to Orbeon Forms, I
> >figured it'd
> >> >be best if I asked here first.
> >> >
> >> >I'm trying to write a stylesheet to merge two instances.
> >I'm doing an
> >> >apply-templates on the nodes in my second input (the
> >non-default one)
> >> >and in my template I'm trying to access a node in my default
> >> >instance.
> >> >The obvious way of accessing the node didn't seem to do the trick,
> >> >(//node) neither did trying to call the named input of 'data'
> >> >(doc('input:data')//node) and if I tried to do just
> >doc('')//node it
> >> >seems like it's searching my stylesheet and not my data.
> >> >
> >> >So, basically my question is, how can I specify that I want
> >to search
> >> >the default input when my context is not placed anywhere in that
> >> >document?
> >> >
> >> >--
> >> >Daniel E. Renfer
> >> >http://kronkltd.net/
> >
> >--
> >Daniel E. Renfer
> >http://kronkltd.net/
> >
> >
>
>
>
>
>
> --
> 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
>
>
>

--
Daniel E. Renfer
http://kronkltd.net/


--
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

access-other-node.xpl (2K) Download Attachment