RE: [xsl] using the AND condition

Subject: RE: [xsl] using the AND condition
From: "Avula, Raj" <RAvula@xxxxxxxxxxx>
Date: Wed, 5 Jun 2002 17:28:43 -0700
try this.

	<xsl:template match="/ListOfInsClaimsContact">
		<xsl:for-each
select="InsClaimsContact[RoleInAccident='Driver' and
ContactRole='Witness']">
			<xsl:text>DRIVER-WITNESS</xsl:text>
		</xsl:for-each>
		<xsl:for-each
select="InsClaimsContact[RoleInAccident='Owner' and ContactRole='Insured']">
			<xsl:text>OWNER-INSURED</xsl:text>
		</xsl:for-each>
	</xsl:template>

Thanks,
Raj..

-----Original Message-----
From: CROFT, MICHAEL [mailto:MCROFT@xxxxxxxxx]
Sent: Wednesday, June 05, 2002 1:33 PM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: [xsl] using the AND condition


I need to search for elements that contain certain text and are part of a
certain parent element.  I need to search the whole document and find the
specific parent element, that contains certain child elements with certain
text.  This information needs to be printed in order.  For example:
<ListOfInsClaimsContact>
				<InsClaimsContact Id="1-16HHT">
					<BirthDate>04/08/2002
00:00:00</BirthDate>
	
<CellularPhoneNumber>3418748901</CellularPhoneNumber>
					<ContactRole>Insured</ContactRole>>
					<PositionInVehicle>passnege
of</PositionInVehicle>
	
<RoleInAccident>Owner</RoleInAccident>
				</InsClaimsContact>
				<InsClaimsContact Id="2-16HHT">
					<BirthDate>04/08/2002
00:00:00</BirthDate>
	
<CellularPhoneNumber>3418748901</CellularPhoneNumber>
					<ContactRole>Witness</ContactRole>>
					<PositionInVehicle>passnege
of</PositionInVehicle>
	
<RoleInAccident>Driver</RoleInAccident>
				</InsClaimsContact>
</ListOfInsClaimsContact>


Basically my logic needs to say, Find the <InsClaimsContact> element that
contains a <RoleInAccident> element whose data is "Driver", AND a
<ContactRole> element whose data is "Witness", then process this
InsClaimsContact element.
Next, find the <InsClaimsContact> element that contains a <RoleInAccident>
element whose data is "Owner" AND a <ContactRole> element whose data is
"Insured", then process this InsClaimsContact element.
This continues for many possible combinations, and of course the xml content
will not be in the order I need it to print in the report.

Also, this template below wont work....This will match on the first
InsClaimsContact element and do the conditional logic, this wont "force" the
printing of the order I specify.

		<xsl:template match="//InsClaimsContact">
			<xsl:if test="(RoleInAccident='Driver') and
(ContactRole='Insured')">  this could be false for the first match of
InsClaimsContact, and fall to next if.  I need to force it to find these
elements to print.
				FOUND FIRST MATCH; PRINT THIS
InsClaimsContact elements information FIRST
			</xsl:if>
			<xsl:if test="(RoleInAccident='Owner') and
(ContactRole='Witness')">
				FOUND SECOND MATCH; PRINT THIS
InsClaimsContact elements information SECOND
			</xsl:if>
		</xsl:template>


Mike



**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the sender and postmaster@xxxxxxxxxx
**********************************************************************
 


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


"MMS <firstam.com>" made the following
 annotations on 06/05/02 17:30:32
------------------------------------------------------------------------------
"THIS E-MAIL MESSAGE AND ANY FILES TRANSMITTED HEREWITH, ARE INTENDED SOLELY FOR THE USE OF THE INDIVIDUAL(S) ADDRESSED AND MAY CONTAIN CONFIDENTIAL, PROPRIETARY OR PRIVILEGED INFORMATION.  IF YOU ARE NOT THE ADDRESSEE INDICATED IN THIS MESSAGE (OR RESPONSIBLE FOR DELIVERY OF THIS MESSAGE TO SUCH PERSON) YOU MAY NOT REVIEW, USE, DISCLOSE OR DISTRIBUTE THIS MESSAGE OR ANY FILES TRANSMITTED HEREWITH.  IF YOU RECEIVE THIS MESSAGE IN ERROR, PLEASE CONTACT THE SENDER BY REPLY E-MAIL AND DELETE THIS MESSAGE AND ALL COPIES OF IT FROM YOUR SYSTEM."

==============================================================================


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


Current Thread