dcsimg
Results 1 to 2 of 2

Thread: How do I add conditions to xslt?

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2013
    Posts
    42

    How do I add conditions to xslt?

    I want to check if CompDate has an Op code =E or A
    OR if TimeStampChange node is the only node with Op code =E
    AND if there are no Op codes on any other child nodes?
    i.e. CaseEvent\TimeStampChange Op="E" and there are no Op codes on any other child elements.

    If statement will be True when TimeStampChange is the only node in CaseEvent that have Op code=E
    If statement will also be true if CompDate Op code =E or A but when TimeStampChange has no Op code.


    Here is the xml that I am reading
    Code:
    <CaseEvent Op="E">
    	<EventDate>08/06/2019</EventDate>
    	<Comment Op="E">no rain</Comment>
    	<Deleted>false</Deleted>
    	<RevDate Op="E">08/08/2020</RevDate>
    	<CompDate Op="E">08/06/2019</CompDate>
    	<TimestampChange Op="E">08/06/2019 07:11:28:317</TimestampChange>
    	<EventType Word="NOPERWELL">Personal</EventType>
    </CaseEvent>
    Here is my xslt code. I need help adding and condition to also check if any other child nodes in CaseEvent have Op code
    Code:
    <xsl:if test="(@Op='E') and ((EventType/@Word='NOPERWELL') or (EventType/@Word='NORIGHTS')) and ((CompDate[@Op='A']) or (CompDate[@Op='E']) or ((TimestampChange[@Op='E']) and (//CaseEvent[not(@Op)]/*)))">

  2. #2

    Thread Starter
    Member
    Join Date
    Sep 2013
    Posts
    42

    Re: How do I add conditions to xslt?

    Quote Originally Posted by winkimjr2 View Post
    I want to check if CompDate has an Op code =E or A
    OR if TimeStampChange node is the only node with Op code =E
    AND if there are no Op codes on any other child nodes?
    i.e. CaseEvent\TimeStampChange Op="E" and there are no Op codes on any other child elements.

    If statement will be True when TimeStampChange is the only node in CaseEvent that have Op code=E
    If statement will also be true if CompDate Op code =E or A but when TimeStampChange has no Op code.


    Here is the xml that I am reading
    Code:
    <CaseEvent Op="E">
    	<EventDate>08/06/2019</EventDate>
    	<Comment Op="E">no rain</Comment>
    	<Deleted>false</Deleted>
    	<RevDate Op="E">08/08/2020</RevDate>
    	<CompDate Op="E">08/06/2019</CompDate>
    	<TimestampChange Op="E">08/06/2019 07:11:28:317</TimestampChange>
    	<EventType Word="NOPERWELL">Personal</EventType>
    </CaseEvent>
    Here is my xslt code. I need help adding and condition to also check if any other child nodes in CaseEvent have Op code
    Code:
    <xsl:if test="(@Op='E') and ((EventType/@Word='NOPERWELL') or (EventType/@Word='NORIGHTS')) and ((CompDate[@Op='A']) or (CompDate[@Op='E']) or ((TimestampChange[@Op='E']) and (//CaseEvent[not(@Op)]/*)))">
    I no longer need help on this question. It can be deleted

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width