[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Please Help IN: SXL Structure problem

Subject: RE: Please Help IN: SXL Structure problem
From: Edward.Middleton@xxxxxxxxxxx
Date: Fri, 17 Jan 2003 14:45:27 +0900
fmpxmlresult
When you call the servicers_builder template your context is

/fmp:FMPXMLRESULT/fmp:RESULTSET

but what you actually want to do is search all RESULTSET's that have the same PersonID so you need to go from the root node

<!-- ...selecting all the records for this user... -->
<xsl:for-each select="/fmp:FMPXMLRESULT/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>

which will give you exactly what you want.  I think there is also an error in the PersonID in the data you supplied.  Both Jim A and STEVEN B have PersonID 1.

Edward Middleton

-----Original Message-----
From: test s [mailto:stesting@xxxxxxxxxxx]
Sent: Friday, January 17, 2003 2:12 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Please Help IN: SXL Structure problem


The Style Sheet that I used id

<?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">
					<ServiceUsers>
					<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 != ''">
						<ServiceUser>
						<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>
						</ServiceUser>
					<xsl:variable name="vRecordID"><xsl:value-of 
select="fmp:COL[28]/fmp:DATA"/></xsl:variable>
					</xsl:if>
					</xsl:for-each>
					</ServiceUsers>
		</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>








>From: Edward.Middleton@xxxxxxxxxxx
>Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
>Subject: RE:  Please Help IN: SXL Structure problem
>Date: Fri, 17 Jan 2003 11:50:27 +0900
>
>Please post your stylesheet.  There could be many reasions why it is not 
>creating the holidayDestination
>
>Edward Middleton
>
>-----Original Message-----
>From: test s [mailto:stesting@xxxxxxxxxxx]
>Sent: Friday, January 17, 2003 11:32 AM
>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject:  Please Help IN: SXL Structure problem
>
>
>Hi
>I hoave this input Data
>
><?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>1</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>1</DATA></COL><COL><DATA>STEVEN</DATA></COL><COL><DATA>B</DATA></COL><COL><DATA>Holiday4</DATA></COL></ROW></RESULTSET></FMPXMLRESULT>
>
>
>I created a XSL Style sheet to transform it to:
>
><?xml version="1.0" encoding="UTF-8"?>
>
><UserProgram xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>xsi:noNamespaceSchemaLocation="C:\xmldocs\csdaschema.xsd">
>
><Users>
><User RecordId="1">
><PersonID>1</PersonID>
><FirstName>JIM</FirstName>
><LastName>A</LastName>
><HolidayDestinations>
>	<HolidayDestinations>Holiday1</HolidayDestinations>
>	<HolidayDestinations>Holiday2</HolidayDestinations>
></HolidayDestinations>
></User>
><User RecordId="2">
><PersonID>2</PersonID>
><FirstName>STEVEN</FirstName>
><LastName>B</LastName>
><HolidayDestinations>
>	<HolidayDestinations>Holiday3</HolidayDestinations>
>	<HolidayDestinations>Holiday4</HolidayDestinations>
></HolidayDestinations>
></User>
></UserProgram>
>
>
>
>But the problem the out put are not showwing the holidayDestination the
>output data are comming up as:
>
><?xml version="1.0" encoding="UTF-8"?>
>
><UserProgram xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>xsi:noNamespaceSchemaLocation="C:\xmldocs\csdaschema.xsd">
>
><Users>
>
><User RecordId="1">
>
><PersonID>1</PersonID>
>
><FirstName>JIM</FirstName>
>
><LastName>A</LastName>
>
><HolidayDestinations/>
>
></User>
>
><User RecordId="2">
>
><PersonID>2</PersonID>
>
><FirstName>STEVEN</FirstName>
>
><LastName>B</LastName>
>
><HolidayDestinations/>
>
></User>
>
></UserProgram>
>
>
>
>Does any one know anything about this problem, thanks in advance for your
>help
>
>
>
>_________________________________________________________________
>Add photos to your e-mail with MSN 8. Get 2 months FREE*.
>http://join.msn.com/?page=features/featuredemail
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.