Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 11th, 2016, 01:35 PM
Friend of Wrox
 
Join Date: Apr 2013
Posts: 101
Thanks: 14
Thanked 0 Times in 0 Posts
Default How to I check Protection order that have current as true and display it as attribute

My template is correctly displaying output when any CasePartyName has an Op='E'.
It is also correctly displaying output when any CaseParty/ObservedRace has an Op='E' or CaseParty/ObeservedEthnicity has an Op='E' and Connection/@Word='RSP'

Current output
Code:
<NotificationEvent notificationType="CasePartyUpdates" >CasePartyUpdate</NotificationEvent>
Now I would like to add an attribute to the above output to display the ProtectionOrder number/s of any ProtectionOrder/s that have Status/Current="true" and Status/Type/@Word="SBJO or SBJOCOR".

Here is what the output based on my xml document should look like..

Code:
<NotificationEvent notificationType="CasePartyUpdates" activeSignedPoNumbers="1605923">CasePartyUpdate</NotificationEvent>
If there were more qualified protectionorders, their numbers would be displayed as activeSignedPoNumber="1605923, 111, 078, 4532" etc.

I am stuck that is why I opted to get help.

My xml document
Code:
<Integration>
	<ControlPoint>SAVE-FAM-CASE</ControlPoint>
	<Case>
		<CaseCategory>FAM</CaseCategory>
		<CaseType Word="DMA">Domestic Abuse</CaseType>
		<CaseParty>
			<ObservedRace Word="W">White</ObservedRace>
			<ObservedEthnicity Word="NH">Non Hispanic</ObservedEthnicity>
			<Connection Word="PET">
			</Connection>
		</CaseParty>
		<CaseParty Op="E">
			<ObservedRace Op="E" Word="M">Multiracial</ObservedRace>
			<ObservedEthnicity Op="E" Word="R">Refused</ObservedEthnicity>
			<Connection Word="RSP">
			</Connection>
		</CaseParty>
		<ProtectionOrders>
			<ProtectionOrder InternalProtectionOrderID="11257">
				<ProtectionOrderNumber>1605921</ProtectionOrderNumber>
				<Statuses>
					<Status>
						<Current>true</Current>
						<Type Word="SUPERSEDED">Superseded</Type>
					</Status>
					<Status>
						<Current>false</Current>
						<Type Word="SBJOCOR">Corrected - Signed By Judicial Officer</Type>
					</Status>
				</Statuses>
			</ProtectionOrder>
			<ProtectionOrder InternalProtectionOrderID="11259">
				<ProtectionOrderNumber>1605923</ProtectionOrderNumber>
				<Statuses>
					<Status>
						<Current>true</Current>
						<Type Word="SBJOCOR">Corrected - Signed By Judicial Officer</Type>
					</Status>
					<Status>
						<Current>false</Current>
						<Type Word="SBJO">Signed By Judicial Officer</Type>
					</Status>
				</Statuses>
			</ProtectionOrder>
		</ProtectionOrders>
	</Case>
</Integration>
Xslt template
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" >
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:template match="/">
			<xsl:call-template name="CasePartyUpdates"/>
	<xsl:template name="CasePartyUpdates">
		<xsl:if test="Integration/ControlPoint='SAVE-FAM-CASE'">
			<xsl:if test="Integration/Case/CaseType/@Word='DMA'">
				<xsl:variable name="vActiveSignedPoNumbers">
					<!--Loop through each PO if current status is SBJO OR SBJOCOR add the PO number -->
				</xsl:variable>
				<xsl:if test="(string-length($vActiveSignedPoNumbers)>0)">
				<xsl:for-each select="Integration/Case">
						<xsl:choose>
							<xsl:when test="(count(CaseParty[((ObservedRace/@Op='E') or (ObservedEthnicity/@Op='E')) and (Connection/@Word='RSP')] )>0)">
								<NotificationEvent notificationType="CasePartyUpdates">
									<xsl:attribute name="activeSignedPoNumbers"><xsl:value-of select="$vActiveSignedPoNumbers"/></xsl:attribute>
									<xsl:text>CasePartyUpdate</xsl:text>
								</NotificationEvent>
							</xsl:when>
							<xsl:when test="(count(CaseParty[CasePartyName/@Op='E']) >0)">
								<NotificationEvent notificationType="CasePartyUpdates">
									<xsl:attribute name="activeSignedPoNumbers"><xsl:value-of select="$vActiveSignedPoNumbers"/></xsl:attribute>
									<xsl:text>CasePartyUpdate</xsl:text>
								</NotificationEvent>
							</xsl:when>
						</xsl:choose>
					</xsl:for-each>
				</xsl:if>
			</xsl:if>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>
 
Old October 13th, 2016, 07:28 AM
Friend of Wrox
 
Join Date: Apr 2013
Posts: 101
Thanks: 14
Thanked 0 Times in 0 Posts
Default I no longer need help with this question

I have resolved this issue





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Either BOF or EOF is True, or the current record has been deleted. Hannibal Classic ASP Basics 1 April 6th, 2010 01:18 PM
Removing attribute xsi:nil=true chandra_perni XSLT 10 September 2nd, 2009 12:05 PM
Check if dropdown readonly property is "true" ismailc XSLT 2 January 21st, 2008 04:18 AM
return tree untill attribute is true jdiderik XSLT 4 May 3rd, 2005 09:42 AM
Either BOF or EOF is True, or the current record h gilgalbiblewheel Classic ASP Databases 3 March 9th, 2005 07:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.