[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Comparing previous
Hi all, I'm hoping someone can help me. Here's my problem: I am accessing a sorted node list using apply-templates and wish to compare against the previous node in the sorted node set when accessing the current node in the matched template. Frankly the penny just hasn't dropped for me and Xpath, and if it wasn't for M. Kay's book I'd be lost. I was thinking self::node()[position()-1], but this doesn't seem to work. FWIW there are multiple wk_wks nodes and multiple wk_wks_parcel nodes as children to the wk_wks nodes. wk_wks_parcel nodes may be repeated across multiple wk_wks nodes. My goal is to display them all in a list but only once. Code snippets follow. .... <xsl:apply-templates select="wk_wks/wk_wks_parcel" mode="permit"> <xsl:sort select="t_pcl_type"/> <xsl:sort select="t_easement"/> <xsl:sort select="t_historical"/> <xsl:sort select="t_lot"/> <xsl:sort select="t_plan"/> <xsl:sort select="t_mining"/> </xsl:apply-templates> .... <xsl:template match="wk_wks_parcel" mode="permit"> <xsl:choose> <xsl:when test="position()=last()"> <xsl:text> and </xsl:text> </xsl:when> <xsl:when test="position()!=1"> <xsl:text>, </xsl:text> <xsl:text>(Prev: "</xsl:text> <!-- display here now, compare later --> <xsl:call-template name="show_works_parcel_text"> <xsl:with-param name="parcel_node" select="preceding-sibling::*"/> </xsl:call-template> <xsl:text>") </xsl:text> </xsl:when> </xsl:choose> <xsl:call-template name="show_works_parcel_text"> <xsl:with-param name="parcel_node" select="."/> </xsl:call-template> </xsl:template> Cheers Tim Keen Analyst Programmer WERD Project Dept of Natural Resources & Mines 4th Floor, Mineral House 41 George St Brisbane QLD 4000 (07) 3224 2559 (ph) (07) 3224 7963 (fax) tim.keen@xxxxxxxxxxxxxx ************************************************************************ The information in this e-mail together with any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any form of review, disclosure, modification, distribution and/or publication of this e-mail message is prohibited. If you have received this message in error, you are asked to inform the sender as quickly as possible and delete this message and any copies of this message from your computer and/or your computer system network. ************************************************************************ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|