Hi,
I have a xhtml page in which I am also declaring xsl:version="2.0" at the top since I need to dynamically generate stuff based on the output of a pipeline. However, there are static elements that I am defining in an xforms:instance at the top of the page and I was wondering how I can access these in an xsl statement lower down: <html xsl:version="2.0"> <head> <xforms:models> <xforms:instance id="types"> <type>... <type>... ... </xforms:instance> ... </xforms:model> </head> <body> ... <xsl:for-each select="instance('types')"> ... </xsl:for-each> </body> </html> Cheers, Matthew -- 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 |
Mathew,
You would reference the instance as follows: <xsl:for-each select="doc('input:instance')"> Duane On Jan 20, 2006, at 10:11 PM, Matthew Graham wrote: > Hi, > > I have a xhtml page in which I am also declaring xsl:version="2.0" > at the top since I need to dynamically generate stuff based on the > output of a pipeline. However, there are static elements that I am > defining in an xforms:instance at the top of the page and I was > wondering how I can access these in an xsl statement lower down: > > <html xsl:version="2.0"> > <head> > <xforms:models> > <xforms:instance id="types"> > <type>... > <type>... > ... > </xforms:instance> > ... > </xforms:model> > </head> > <body> > ... > <xsl:for-each select="instance('types')"> > ... > </xsl:for-each> > </body> > </html> > > Cheers, > > Matthew > > > -- > 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 |
In reply to this post by mjgraham
Matthew,
To access the instance from XSLT just treat it as the root, so if you have the following <xforms:instance id="type"> <instance> <type>..</type> <type>..</type> <type>..</type> </instance> </xforms:instance> The xsl would be <xsl:for-each select="/instance/type"> ... </xsl:for-each> Hope this helps Ryan Puddephatt Web Developer TFX Group 1 Michaelson Square Livingston West Lothian Scotand EH54 7DP * [hidden email] ( 01506 407 110 7 01506 407 108 >-----Original Message----- >From: Matthew Graham [mailto:[hidden email]] >Sent: 21 January 2006 03:12 >To: [hidden email] >Subject: [ops-users] Referring to instance data in a stylesheet > >Hi, > >I have a xhtml page in which I am also declaring xsl:version="2.0" at >the top since I need to dynamically generate stuff based on the output >of a pipeline. However, there are static elements that I am defining in >an xforms:instance at the top of the page and I was wondering how I can >access these in an xsl statement lower down: > ><html xsl:version="2.0"> ><head> ><xforms:models> ><xforms:instance id="types"> > <type>... > <type>... > ... ></xforms:instance> >... ></xforms:model> ></head> ><body> >... ><xsl:for-each select="instance('types')"> >... ></xsl:for-each> ></body> ></html> > > Cheers, > > Matthew -- 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 |
Hi,
This is not the behaviour I see: the page flow part for this xhtml page is: <page id="publish" view="publish.xhtml" model="publish.xpl"/> and the xsl elements in publish.xhtml act on the data from the model - publish.xpl - and not the instance definitions in the xforms:model at the top of publish.xhtml. BTW I am using OPS 3.0final. Cheers, Matthew Ryan Puddephatt wrote: >Matthew, > To access the instance from XSLT just treat it as the root, so if >you have the following > ><xforms:instance id="type"> > <instance> > <type>..</type> > <type>..</type> > <type>..</type> > </instance> ></xforms:instance> > >The xsl would be > ><xsl:for-each select="/instance/type"> > ... ></xsl:for-each> > >Hope this helps > >Ryan Puddephatt >Web Developer >TFX Group >1 Michaelson Square >Livingston >West Lothian >Scotand >EH54 7DP > >* [hidden email] >( 01506 407 110 >7 01506 407 108 > > > >>-----Original Message----- >>From: Matthew Graham [mailto:[hidden email]] >>Sent: 21 January 2006 03:12 >>To: [hidden email] >>Subject: [ops-users] Referring to instance data in a stylesheet >> >>Hi, >> >>I have a xhtml page in which I am also declaring xsl:version="2.0" at >>the top since I need to dynamically generate stuff based on the output >>of a pipeline. However, there are static elements that I am defining in >>an xforms:instance at the top of the page and I was wondering how I can >>access these in an xsl statement lower down: >> >><html xsl:version="2.0"> >><head> >><xforms:models> >><xforms:instance id="types"> >> <type>... >> <type>... >> ... >></xforms:instance> >>... >></xforms:model> >></head> >><body> >>... >><xsl:for-each select="instance('types')"> >>... >></xsl:for-each> >></body> >></html> >> >> Cheers, >> >> Matthew >> -- 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 |
Try doc('input:type')/instance/type I don't have eclipse running so I can't
try it Should work though Ryan Puddephatt Web Developer TFX Group 1 Michaelson Square Livingston West Lothian Scotand EH54 7DP * [hidden email] ( 01506 407 110 7 01506 407 108 >-----Original Message----- >From: Matthew Graham [mailto:[hidden email]] >Sent: 21 January 2006 17:06 >To: [hidden email] >Subject: Re: [ops-users] Referring to instance data in a stylesheet > >Hi, > >This is not the behaviour I see: the page flow part for this xhtml page is: > ><page id="publish" view="publish.xhtml" model="publish.xpl"/> > >and the xsl elements in publish.xhtml act on the data from the model - >publish.xpl - and not the instance definitions in the xforms:model at >the top of publish.xhtml. BTW I am using OPS 3.0final. > > Cheers, > > Matthew > >Ryan Puddephatt wrote: > >>Matthew, >> To access the instance from XSLT just treat it as the root, so if >>you have the following >> >><xforms:instance id="type"> >> <instance> >> <type>..</type> >> <type>..</type> >> <type>..</type> >> </instance> >></xforms:instance> >> >>The xsl would be >> >><xsl:for-each select="/instance/type"> >> ... >></xsl:for-each> >> >>Hope this helps >> >>Ryan Puddephatt >>Web Developer >>TFX Group >>1 Michaelson Square >>Livingston >>West Lothian >>Scotand >>EH54 7DP >> >>* [hidden email] >>( 01506 407 110 >>7 01506 407 108 >> >> >> >>>-----Original Message----- >>>From: Matthew Graham [mailto:[hidden email]] >>>Sent: 21 January 2006 03:12 >>>To: [hidden email] >>>Subject: [ops-users] Referring to instance data in a stylesheet >>> >>>Hi, >>> >>>I have a xhtml page in which I am also declaring xsl:version="2.0" at >>>the top since I need to dynamically generate stuff based on the output >>>of a pipeline. However, there are static elements that I am defining in >>>an xforms:instance at the top of the page and I was wondering how I can >>>access these in an xsl statement lower down: >>> >>><html xsl:version="2.0"> >>><head> >>><xforms:models> >>><xforms:instance id="types"> >>> <type>... >>> <type>... >>> ... >>></xforms:instance> >>>... >>></xforms:model> >>></head> >>><body> >>>... >>><xsl:for-each select="instance('types')"> >>>... >>></xsl:for-each> >>></body> >>></html> >>> >>> Cheers, >>> >>> Matthew >>> > -- 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 |
Administrator
|
In reply to this post by mjgraham
Matthew,
So you are saying that the content of your <instance> document is static, i.e. its values do not come from the model? Whatever the situation, you can works around this by using variables in XSLT, e.g.: <xsl:variable name="my-instance" as="element()"> <instance> <type>..</type> </instance> <xsl:variable> To copy the whole instance: <xsl:copy-of select="$my-instance"/> To iterate over the values: <xsl:for-each select="$my-instance/type"> ... </xsl:for-each> You have to be aware that the page view runs only once when the page is requested, and that your XSLT instructions will not run again when the user interacts with the XForms page. Also, obviously, XSLT cannot access any XForms function. You really have to look at this as follows: o page is requested o page model runs o page view runs, including XSLT code o result of page view is sent to XForms engine o user interacts with resulting XForms page -Erik Matthew Graham wrote: > Hi, > > This is not the behaviour I see: the page flow part for this xhtml page is: > > <page id="publish" view="publish.xhtml" model="publish.xpl"/> > > and the xsl elements in publish.xhtml act on the data from the model - > publish.xpl - and not the instance definitions in the xforms:model at > the top of publish.xhtml. BTW I am using OPS 3.0final. > > Cheers, > > Matthew > > Ryan Puddephatt wrote: > >> Matthew, >> To access the instance from XSLT just treat it as the root, so if >> you have the following >> >> <xforms:instance id="type"> >> <instance> >> <type>..</type> >> <type>..</type> >> <type>..</type> >> </instance> >> </xforms:instance> >> >> The xsl would be >> >> <xsl:for-each select="/instance/type"> >> ... >> </xsl:for-each> >> >> Hope this helps >> >> Ryan Puddephatt >> Web Developer >> TFX Group >> 1 Michaelson Square >> Livingston >> West Lothian >> Scotand >> EH54 7DP >> >> * [hidden email] >> ( 01506 407 110 >> 7 01506 407 108 >> >> >> >>> -----Original Message----- >>> From: Matthew Graham [mailto:[hidden email]] >>> Sent: 21 January 2006 03:12 >>> To: [hidden email] >>> Subject: [ops-users] Referring to instance data in a stylesheet >>> >>> Hi, >>> >>> I have a xhtml page in which I am also declaring xsl:version="2.0" at >>> the top since I need to dynamically generate stuff based on the output >>> of a pipeline. However, there are static elements that I am defining in >>> an xforms:instance at the top of the page and I was wondering how I can >>> access these in an xsl statement lower down: >>> >>> <html xsl:version="2.0"> >>> <head> >>> <xforms:models> >>> <xforms:instance id="types"> >>> <type>... >>> <type>... >>> ... >>> </xforms:instance> >>> ... >>> </xforms:model> >>> </head> >>> <body> >>> ... >>> <xsl:for-each select="instance('types')"> >>> ... >>> </xsl:for-each> >>> </body> >>> </html> >>> >>> Cheers, >>> >>> Matthew >>> > > > > ------------------------------------------------------------------------ > > > -- > 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 -- 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 |
Free forum by Nabble | Edit this page |