xsl-list
[Top] [All Lists]

RE: Output based on the existence of a particular piece of data in a list

2003-04-07 11:51:25
It's difficult to know what aspect of this problem you are finding
difficult, since you haven't shown us your attempts to solve it.

Use <xsl:choose> to switch between the success/failure outputs

Use test="/*/AcctngCodeOut/Error" to test for the presence of an Error
element.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Martin, Tripp
Sent: 07 April 2003 16:39
To: 'XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: [xsl] Output based on the existence of a particular 
piece of data in a list


I've got the following incoming XML:

<AC:validateAcctngCodeResponse xmlns:AC="AcctngActivityWS">
  <UserId>U712345</UserId>
  <AcctngCodeOut>
      <Type>CC</Type>
      <Identifier>1234</Identifier>
      <Status>OK</Status>
      <StatusText>Document has no errors.</StatusText>
  </AcctngCodeOut>
  <AcctngCodeOut>
      <Type>P</Type>
      <Identifier>54321</Identifier>
      <Status>OK</Status>
      <StatusText>Document has no errors.</StatusText>
  </AcctngCodeOut>
  <AcctngCodeOut>
      <Type>O</Type>
      <Identifier>78960</Identifier>
      <Status>Error</Status>
      <StatusText>Order 78960 does not exist</StatusText>
  </AcctngCodeOut>
</AC:validateAcctngCodeResponse>

I need to make my output based on the existence of a <Status> 
tag with "Error".  So, in the case above I want to have: 
<accountcheckreply>
      <success>false</success>
      <message type="error">
         <code>1</code>
         <description>Order 78960 does not exist</description>
      </message>
</accountcheckreply>

Whereas if there were no errors in the incoming document, I would have
simply:
<accountcheckreply>
      <success>true</success>
</accountcheckreply>

I haven't been able to figure out what I need to use to make 
this happen. Can anyone offer a suggestion of where to start?

Thanks,
Tripp

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



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



<Prev in Thread] Current Thread [Next in Thread>