June 19, 200520 yr 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
June 20, 200520 yr Author 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?
June 20, 200520 yr 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>
June 23, 200520 yr Author 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?
Create an account or sign in to comment