Re: [xsl] xslt 2 when test multiple conditions

Subject: Re: [xsl] xslt 2 when test multiple conditions
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 19 Aug 2023 08:20:39 -0000
your xsl fragment doesn't match your xml unless we infer some parent
elements and namespaces, but  your value-of ignores the context of your
test.

You have

if there is a Safety_MedicalAE Questionnaire anywhere in the document
 output all sf:Response_GCC__c  that are siblings of indication
else
 output all sf:Response_GCC__c  that are siblings of indication

so both branches produce the same  output, which is all indications.



David

On Fri, 18 Aug 2023 at 23:06, Michael Kay michaelkay90@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Couldn't you simplify the example to make the relevant data stand out?
> Spotting what you're talking about in this example is like a spot-the-ball
> competition: too much noise, not enough signal.
>
> Surprisingly often, producing a simplified example actually enables you to
> find the solution yourself.
>
> Michael Kay
> Saxonica
>
> On 18 Aug 2023, at 21:08, LEGAULT, PHILLIP plegault@xxxxxxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>
> I have an xml file with answers to multiple questionnaires. When one of
> the questionnaires <Safety_MedicalAE Questionnaire> has answered the same
> question different from on of the other questionnaires I need the
> Safety_MedicalAE Questionnaire response without the others.
>
> Example
>
> <records xsi:type="sf:Response_GCC__c">
>          <sf:Id xsi:nil="true"/>
>          <sf:Question_GCC__c>Why was the patient using the
> product?</sf:Question_GCC__c>
>          <sf:QuestionnaireQuestion_GCC__r
> xsi:type="sf:QuestionnaireQuestion_GCC__c">
>             <sf:Id xsi:nil="true"/>
>             <sf:DSMapping_GCC__c>Indication</sf:DSMapping_GCC__c>
>             <sf:Questionnaire_GCC__r xsi:type="sf:Questionnaire_GCC__c">
>                <sf:Id xsi:nil="true"/>
>
> <sf:DownstreamSystemName_GCC__c>Safety</sf:DownstreamSystemName_GCC__c>
>                <sf:QuestionnaireIdentifier_GCC__c>Safety_MedicalAE
> Questionnaire</sf:QuestionnaireIdentifier_GCC__c>
>             </sf:Questionnaire_GCC__r>
>          </sf:QuestionnaireQuestion_GCC__r>
>          <sf:Response_GCC__c>rash</sf:Response_GCC__c>
>       </records>
>
>       <records xsi:type="sf:Response_GCC__c">
>          <sf:Id xsi:nil="true"/>
>          <sf:Question_GCC__c>Why was the patient using the
> product?</sf:Question_GCC__c>
>          <sf:QuestionnaireQuestion_GCC__r
> xsi:type="sf:QuestionnaireQuestion_GCC__c">
>             <sf:Id xsi:nil="true"/>
>             <sf:DSMapping_GCC__c>Indication</sf:DSMapping_GCC__c>
>             <sf:Questionnaire_GCC__r xsi:type="sf:Questionnaire_GCC__c">
>                <sf:Id xsi:nil="true"/>
>
> <sf:DownstreamSystemName_GCC__c>Safety</sf:DownstreamSystemName_GCC__c>
>                <sf:QuestionnaireIdentifier_GCC__c>Safety_Medical_FULL
> Questionnaire</sf:QuestionnaireIdentifier_GCC__c>
>             </sf:Questionnaire_GCC__r>
>          </sf:QuestionnaireQuestion_GCC__r>
>          <sf:Response_GCC__c>cough</sf:Response_GCC__c>
>       </records>
>
>
> I have tried
>
> <xsl:choose>
> <xsl:when
> test="/records/sf:Case_Responses_GCC__r/records/sf:QuestionnaireQuestion_GCC__r/sf:Questionnaire_GCC__r[sf:QuestionnaireIdentifier_GCC__c='Safety_MedicalAE
> Questionnaire']/../sf:DSMapping_GCC__c='Indication'">
>   <xsl:value-of
> select="/records/sf:Case_Responses_GCC__r/records/sf:QuestionnaireQuestion_GCC__r[sf:DSMapping_GCC__c='Indication']/../sf:Response_GCC__c"/>
> </xsl:when>
>     <xsl:otherwise>
>       <xsl:value-of
> select="/records/sf:Case_Responses_GCC__r/records/sf:QuestionnaireQuestion_GCC__r[sf:DSMapping_GCC__c='Indication']/../sf:Response_GCC__c"/>
>     </xsl:otherwise>
> </xsl:choose>
>
>
> However, I get both responses rash cough
>
> Thanks in advance for your help.
>
>
> *Phil Legault*
> RDx Platform Lead
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/3500899> (by
> email)
>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2739265> (by
> email <>)

Current Thread