View Single Post
  #10 (permalink)  
Old May 31st, 2015, 02:11 AM
arshad arshad is offline
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to give two responses using single xslt.

Response:
<sear:searchCustomerSummaryWithContactResponse xmlns:sear="http://www.example.org/SearchCustomerSummaryWithContact/">
<returnedCustomers>
<externalID>S2640296D</externalID>
<idType>2</idType>
<GeographicAddress>
<locationDesc>string</locationDesc>
<floorLvlUnitDesc>string</floorLvlUnitDesc>
<floor>#11-07</floor>
<unitNumber>#11-07</unitNumber>
<block>1</block>
<blockNumber>93</blockNumber>
<buildingName>raam</buildingName>
<devName>ORCHID PARK CONDO</devName>
<postalCode>768451</postalCode>
<street>YISHUN ST 81</street>
<streetNumber>YISHUN ST 81</streetNumber>
<country>SGP</country>
<state/>
<localityNm/>
</GeographicAddress>
<contactMean>
<locationDesc>string</locationDesc>
<floorLvlUnitDesc>string</floorLvlUnitDesc>
<floor>#11-07</floor>
<unitNumber>#11-07</unitNumber>
<block>1</block>
<blockNumber>93</blockNumber>
<buildingName>raam</buildingName>
<devName>ORCHID PARK CONDO</devName>
<postalCode>768451</postalCode>
<street>YISHUN ST 81</street>
<streetNumber>YISHUN ST 81</streetNumber>
<country>SGP</country>
<state/>
<localityNm/>
</contactMean>
<birthdate>24/03/1952</birthdate>
<formattedName>BEK CHEE YIANG</formattedName>
<familyName>Adapa</familyName>
<givenName>Ram</givenName>
<emailAddress>adapacmram@gmail.com</emailAddress>
<gender>M</gender>
<nationality>Indian</nationality>
<salutation>MR</salutation>
<race>A</race>
</returnedCustomers>
</sear:searchCustomerSummaryWithContactResponse>


XSLT for the above one is:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:v2="http://group.singtel.com/app/mcash/mcashcustomerprofilesearch/v2_0" xmlns:v21="http://group.singtel.com/app/mcash/mcashcustomerprofilesearchschema/v2_0">
<xsl:template match="/">

<v2:getCustomerInfoResponse>
<xsl:for-each select="sear:searchCustomerSummaryWithContactRespo nse" xmlns:sear="http://www.example.org/SearchCustomerSummaryWithContact/">

<v21:customerDetails>
<xsl:for-each select="returnedCustomers">

<v21:acctNo><xsl:value-of select="externalID"/></v21:acctNo>
<v21:acctNoType><xsl:value-of select="idType"/></v21:acctNoType>

<v21:customerAddress>
<xsl:for-each select="GeographicAddress">
<v21:locationDesc><xsl:value-of select="locationDesc"/></v21:locationDesc>
<v21:floorLvlUnitDesc><xsl:value-of select="floorLvlUnitDesc"/></v21:floorLvlUnitDesc>
<v21:floorLvlUnitNo><xsl:value-of select="floorunitNumber"/></v21:floorLvlUnitNo>
<v21:blkHseDesc><xsl:value-of select="block"/></v21:blkHseDesc>
<v21:blkHseNo><xsl:value-of select="blockNumber"/></v21:blkHseNo>
<v21:bldgNm><xsl:value-of select="buildingName"/></v21:bldgNm>
<v21:devNm><xsl:value-of select="devName"/></v21:devNm>
<v21:postalCd><xsl:value-of select="postalCode"/></v21:postalCd>
<v21:streetNm><xsl:value-of select="streetName"/></v21:streetNm>
<v21:country><xsl:value-of select="country"/></v21:country>
<v21:state><xsl:value-of select="state"/></v21:state>
<v21:localityNm><xsl:value-of select="localityNm"/></v21:localityNm>
</xsl:for-each>
</v21:customerAddress>

<v21:billingAddress>
<xsl:for-each select="contactMean" >
<v21:locationDesc><xsl:value-of select="locationDesc"/></v21:locationDesc>
<v21:floorLvlUnitDesc><xsl:value-of select="floorLvlUnitDesc"/></v21:floorLvlUnitDesc>
<v21:floorLvlUnitNo><xsl:value-of select="floorunitNumber"/></v21:floorLvlUnitNo>
<v21:blkHseDesc><xsl:value-of select="block"/></v21:blkHseDesc>
<v21:blkHseNo><xsl:value-of select="blockNumber"/></v21:blkHseNo>
<v21:bldgNm><xsl:value-of select="uildingName"/></v21:bldgNm>
<v21:devNm><xsl:value-of select="devName"/></v21:devNm>
<v21:postalCd><xsl:value-of select="postalCode"/></v21:postalCd>
<v21:streetNm><xsl:value-of select="treetName"/></v21:streetNm>
<v21:country><xsl:value-of select="country"/></v21:country>
<v21:state><xsl:value-of select="state"/></v21:state>
<v21:localityNm><xsl:value-of select="localityNm"/></v21:localityNm>
</xsl:for-each>
</v21:billingAddress>

<v21:dateOfBirth><xsl:value-of select="birthdate"/> </v21:dateOfBirth>
<v21:nm><xsl:value-of select="formattedName"/> </v21:nm>
<v21:lastNm><xsl:value-of select="familyName"/> </v21:lastNm>
<v21:firstName><xsl:value-of select="givenName"/> </v21:firstName>
<v21:emailAddr><xsl:value-of select="emailAddress"/> </v21:emailAddr>
<v21:gender><xsl:value-of select="gender"/> </v21:gender>
<v21:nationality><xsl:value-of select="nationality"/> </v21:nationality>
<v21:salutation><xsl:value-of select="salutation"/> </v21:salutation>
<v21:race><xsl:value-of select="race"/> </v21:race>

</xsl:for-each>
</v21:customerDetails>

</xsl:for-each>
</v2:getCustomerInfoResponse>

</xsl:template>
</xsl:stylesheet>

but i need to include fault response in it:
<sear:searchCustomerSummaryWithContactResponse xmlns:sear="http://www.example.org/SearchCustomerSummaryWithContact/">
<status>false</status>
<errCode>40015</errCode>
<errMessage>Generic exception encountered</errMessage>
</sear:searchCustomerSummaryWithContactResponse>



how to include it in the same xslt?
Reply With Quote