RussellB Posted June 19, 2005 Posted June 19, 2005 Can someone fill me in on how to display data from a portal using XSLT? I tried this... <xsl:for-each select="fmrs:relatedset[@table='line_items']/fmrs:record"? <xsl:value-of select="fmrs:field[@name='line_items::item_desc']/fmrs:data"/> </xsl:for-each> No error reported and the results were included in the XML resultset tree - but not displayed in the final HTML. Portal exists on the layout with the field item_desc in the portal. Thanks
RussellB Posted June 20, 2005 Author Posted June 20, 2005 Hey I got it working using the following... <xsl:for-each select="/fmrs:fmresultset/fmrs:resultset/fmrs:record"><xsl:variable name="record" select="current()"/> <xsl:for-each select="$record/fmrs:relatedset[@table = 'line_items']/fmrs:record"><xsl:variable name="portal-record" select="current()"/> <xsl:value-of select="$portal-record/fmrs:field[@name = 'line_items::item_desc']/fmrs:data[1]"/><br/> </xsl:for-each> </xsl:for-each> Can someone enlighten me as to why we need to use variables in this way?
Martin Brändle Posted June 20, 2005 Posted June 20, 2005 That's too complicated. <xsl:for-each select="fmrs:relatedset[@table='line_items']/fmrs:record"> <xsl:variable name="portal-row" select="current()"/> <xsl:value-of select="$portal-row/fmrs:field[@name='line_items::item_desc']/fmrs:data"/> </xsl:for-each> does the job. From the W3C XSLT 1.0 spec: The current function returns a node-set that has the current node as its only member. For an outermost expression (an expression not occurring within another expression), the current node is always the same as the context node. Thus, <xsl:value-of select="current()"/> means the same as <xsl:value-of select="."/> However, within square brackets the current node is usually different from the context node." So you could even try: <xsl:for-each select="fmrs:relatedset[@table='line_items']/fmrs:record"> <xsl:value-of select="./fmrs:field[@name='line_items::item_desc']/fmrs:data"/> </xsl:for-each>
RussellB Posted June 23, 2005 Author Posted June 23, 2005 Thanks again! Got it working & I understand why (most importantly!). Next problem - I want to be able to delete a portal row (line item in this case). From the primary table (list view) I can delete an item using the following... <a><xsl:attribute name="href">item-delete.xsl?-token.rego-id=<xsl:value-of select="fmrs:field[@name='item_rego_id']/fmrs:data"/>&-recid=<xsl:value-of select="@record-id"/></xsl:attribute>Remove</a> But from another table (ie via a portal) how do I construct the url to go to the related record in line items? In the above url I used -recid=<xsl:value-of select="@record-id" to identify the record item-delete.xsl was to delete. How do I identify the portal row to delete when I am working with a relatedset?
Recommended Posts
This topic is 7094 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now