[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XSL DATA STRUCTURE PROBLEM
Hi, [snip] > THe problem guys is that i need to have a list of the holiday > destination in > every user, The data that i need to be produced is Your problem is a grouping one, and keys will help you: <xsl:key name="id" match="fmp:ROW" use="fmp:COL[1]/fmp:DATA" /> <xsl:template match="fmp:FMPXMLRESULT"> <UserProgram xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\xmldocs\csdaschema.xsd"> <Users> <xsl:for-each select="fmp:RESULTSET/fmp:ROW[generate-id() = generate-id(key('id', fmp:COL[1]/fmp:DATA))]"> <xsl:if test="fmp:COL[1]/fmp:DATA != ''"> <User> <xsl:attribute name="RecordId"> <xsl:value-of select="fmp:COL[1]/fmp:DATA"/> </xsl:attribute> <PersonID> <xsl:value-of select="fmp:COL[1]/fmp:DATA"/> </PersonID> <FirstName> <xsl:value-of select="fmp:COL[2]/fmp:DATA"/> </FirstName> <LastName> <xsl:value-of select="fmp:COL[3]/fmp:DATA"/> </LastName> <xsl:call-template name="servicers_builder"> <xsl:with-param name="i_person_id" select="fmp:COL[1]/fmp:DATA" /> </xsl:call-template> </User> <xsl:variable name="vRecordID"> <xsl:value-of select="fmp:COL[28]/fmp:DATA"/> </xsl:variable> </xsl:if> </xsl:for-each> </Users> </UserProgram> </xsl:template> <xsl:template name="servicers_builder"> <xsl:param name="i_person_id"/> <HolidayDestinations> <!-- ...selecting all the records for this user... --> <xsl:for-each select="key('id', $i_person_id)"> <!-- ...and building a service for each --> <HolidayDestination> <xsl:value-of select="fmp:COL[4]/fmp:DATA"/> </HolidayDestination> </xsl:for-each> </HolidayDestinations> </xsl:template> See Jeni's pages for info on Muenchian Grouping. Cheers, Jarno - Biotek: Die Sect (VNV Nation Remix) 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
|