[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSL DATA STRUCTURE PROBLEM
Hi All,
I have a problem that I am going to ask your help, I am sending this email again in a better format. I will give you all the component for this problem The Input Data is: <?xml version="1.0" encoding="UTF-8" ?><FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"><ERRORCODE>0</ERRORCODE><PRODUCT BUILD="06/13/2002" NAME="FileMaker Pro" VERSION="6.0v1"/> <DATABASE DATEFORMAT="d/M/yyyy" LAYOUT="" NAME="RespiteOptionsDatabase.fp5" RECORDS="195" TIMEFORMAT="h:mm:ss a"/> <METADATA><FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="person_id" TYPE="NUMBER"/><FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="users::FIRST NAME" TYPE="TEXT"/><FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="users::SURNAME" TYPE="TEXT"/><FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Holiday Destination" TYPE="TEXT"/></METADATA> <RESULTSET FOUND="2"><ROW MODID="1" RECORDID="35020"><COL><DATA>1</DATA></COL><COL><DATA>Jim</DATA></COL><COL><DATA>A</DATA></COL><COL><DATA>Holiday1</DATA></COL></ROW><ROW MODID="1" RECORDID="35020"><COL><DATA>1</DATA></COL><COL><DATA>Jim</DATA></COL><COL><DATA>A</DATA></COL><COL><DATA>Holiday2</DATA></COL></ROW><ROW MODID="2" RECORDID="35020"><COL><DATA>2</DATA></COL><COL><DATA>STEVEN</DATA></COL><COL><DATA>B</DATA></COL><COL><DATA>Holiday3</DATA></COL></ROW><ROW MODID="2" RECORDID="35020"><COL><DATA>2</DATA></COL><COL><DATA>STEVEN</DATA></COL><COL><DATA>B</DATA></COL><COL><DATA>Holiday4</DATA></COL></ROW></RESULTSET></FMPXMLRESULT> The XSL Sheet style that i wrote: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/fmpxmlresult" exclude-result-prefixes="fmp"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <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[not(fmp:COL[1]/fmp:DATA=following::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"><xsl:value-of select="fmp:COL[28]/fmp:DATA" /></xsl:with-param> </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="fmp:RESULTSET/fmp:ROW[fmp:COL[1]/fmp:DATA = $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> </xsl:stylesheet> The Output I am getting is: <?xml version="1.0" encoding="UTF-8"?> <UserProgram xsi:noNamespaceSchemaLocation="C:\xmldocs\csdaschema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Users> <User RecordId="1"> <PersonID>1</PersonID> <FirstName>Jim</FirstName> <LastName>A</LastName> <HolidayDestinations> </HolidayDestinations> </User> <User RecordId="2"> <PersonID>2</PersonID> <FirstName>STEVEN</FirstName> <LastName>B</LastName> <HolidayDestinations> </HolidayDestinations> </User> </Users> </UserProgram> 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: <?xml version="1.0" encoding="UTF-8"?> <UserProgram xsi:noNamespaceSchemaLocation="C:\xmldocs\csdaschema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Users> <User RecordId="1"> <PersonID>1</PersonID> <FirstName>Jim</FirstName> <LastName>A</LastName> <HolidayDestinations> <HolidayDestination>Holiday1</HolidayDestination> <HolidayDestination>Holiday2</HolidayDestination> </HolidayDestinations> </User> <User RecordId="2"> <PersonID>2</PersonID> <FirstName>STEVEN</FirstName> <LastName>B</LastName> <HolidayDestinations> <HolidayDestination>Holiday3</HolidayDestination> <HolidayDestination>Holiday4</HolidayDestination> </HolidayDestinations> </User> </Users> </UserProgram> thanks For your time in advance _________________________________________________________________ MSN 8: advanced junk mail protection and 2 months FREE*. http://join.msn.com/?page=features/junkmail 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
|