xsl-list
[Top] [All Lists]

Re: unnecessary soap elements

2005-10-28 06:25:37
Hi All,

      I am sending the working version of xsl and 
sample input, output xml's.
 
Input XML:
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
<soap:Body>
<SubmitRequestResponse xmlns="urn:Fiserv.CWS">
<SubmitRequestResult>
<fiAPI xmlns="http://integration.fiapi.com";>
<Response TypeOfResponse="ERROR">
<Response TypeOfResponse="DocumentInquiryRs"
TotalRows="2">
<Status>
<StatusCode>0</StatusCode>
<Severity/>
</Status>
<DocumentInquiryRs>
<Document>
<Page Number="1" Format="TIFF" View="F">
<Value> note that the encoded (front) image data has
been truncated in this sample
0lGODlhiAbgAvcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/AP//AAAA//8A/wD//////
VKcuQF1V1p8xnXkxWGcxnGcTyAwx3mcDAMCADsA</Value>
</Page>
</Document>
<Document>
<Page Number="1" Format="TIFF" View="B">
<Value> note that the encoded (back) image data has
been truncated in this sample
R0lGODlhiAbYAvcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/AP//AAAA//8A/wD//////</Value>
</Page>
</Document>
</DocumentInquiryRs>
</Response>
</Response>
</fiAPI>
</SubmitRequestResult>
</SubmitRequestResponse>
</soap:Body>
</soap:Envelope>

XSL File:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
    
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
     xmlns:urn="urn:Fiserv.CWS" 
xmlns:fi="http://integration.fiapi.com";
     exclude-result-prefixes="urn fi">

    <xsl:strip-space elements="*"/>
    <xsl:output method="xml" omit-xml-declaration="no"
indent="yes"/>

    <xsl:param name="appType" select="'IMAGE'"/>
    <xsl:param name="frontview" select="'F'"/>
    <xsl:param name="backview" select="'B'"/>

    <!-- Convert XML to XML -->
    <xsl:template match="/">
        <xsl:apply-templates/>
    </xsl:template>
    <xsl:template
match="Body/urn:SubmitRequestResponse">
        <xsl:element name="selectreply">
            <xsl:call-template name="status"/>
            <xsl:element name="selection">
                <xsl:call-template name="imageTags"/>
            </xsl:element>
        </xsl:element>
     </xsl:template>

     <!-- Template for building status element -->
     <xsl:template name="status">
         <xsl:param name="code"
select="urn:SubmitRequestResult/fi:fiAPI/fi:Response/fi:Status/fi:StatusCode"/>
         <xsl:element name="status">
             <xsl:attribute name="code"><xsl:value-of
select="$code"/></xsl:attribute>
         </xsl:element>
     </xsl:template>

      <!-- Template for building image element -->
     <xsl:template name="imageTags">
         <xsl:param name="encoding"
select="'BASE64'"/>
         <xsl:param name="frontView" select="'FBW'"/>
         <xsl:param name="backView" select="'BBW'"/>
        
         <xsl:for-each
select="urn:SubmitRequestResult/fi:fiAPI/fi:Response/fi:DocumentInquiryRs/fi:Document/fi:Page">
             <xsl:if test="string-length(fi:Value) > 0 "> 
                 <xsl:element name="image">
                     <xsl:attribute name="encoding"><xsl:value-of
select="$encoding"/></xsl:attribute>
                     <xsl:attribute name="format"><xsl:value-of
select="@Format"/></xsl:attribute>
                     <xsl:if test="@View = $frontview">
                         <xsl:attribute name="view"><xsl:value-of
select="$frontView"/></xsl:attribute>
                     </xsl:if>
                     <xsl:if test="@View = $backview">
                         <xsl:attribute name="view"><xsl:value-of
select="$backView"/></xsl:attribute>
                     </xsl:if>
                     <xsl:element name="data"><xsl:value-of
select="fi:Value"/>
                     </xsl:element>
                 </xsl:element>         
             </xsl:if> 
         </xsl:for-each>
     </xsl:template>

    <!--
         - Any tag not addressed by a more specific
         - template match is copied unchanged. (This
         - preserves the ph_dispatchmsg tags.)
         -->
        <!-- Here we dump out the rest of the message tags-->

        <xsl:template match="node()|@*">
            <xsl:for-each select=".">
                <xsl:copy>
                    <xsl:apply-templates select="node()|@*"/>
                </xsl:copy>
            </xsl:for-each>
        </xsl:template>
</xsl:stylesheet>

Generated Output:
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
<soap:Body>
<SubmitRequestResponse xmlns="urn:Fiserv.CWS">
<SubmitRequestResult>
<fiAPI xmlns="http://integration.fiapi.com";>
<Response TypeOfResponse="ERROR">
<Response TypeOfResponse="DocumentInquiryRs"
TotalRows="2">
<Status>
<StatusCode>0</StatusCode>
<Severity />
</Status>
<DocumentInquiryRs>
<Document>
<Page Number="1" Format="TIFF" View="F">
<Value> note that the encoded (front) image data has
been truncated in this sample
0lGODlhiAbgAvcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/AP//AAAA//8A/wD//////
VKcuQF1V1p8xnXkxWGcxnGcTyAwx3mcDAMCADsA</Value>
</Page>
</Document>
<Document>
<Page Number="1" Format="TIFF" View="B">
<Value> note that the encoded (back) image data has
been truncated in this sample
R0lGODlhiAbYAvcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/AP//AAAA//8A/wD//////</Value>
</Page>
</Document>
</DocumentInquiryRs>
</Response>
</Response>
</fiAPI>
</SubmitRequestResult>
</SubmitRequestResponse>
</soap:Body>
</soap:Envelope>
      Please provide me a solution.

Thanks&Regards,
Jaya Vardhani M.

--- David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:


    You cannot execute the xsl because i removed
some elements that were using java code. Sorry fot
that.

the output that you show is not generated by
default, so it is generated
by a part of the stylesheet that you didn't show.
The solution is to
change that part. 

Please read
http://www.mulberrytech.com/xsl/xsl-list/#posting
for guidelines on how to phrase questions in a way
that gives people a
chance to answer them.


David


________________________________________________________________________
This e-mail has been scanned for all viruses by
Star. The
service is powered by MessageLabs. For more
information on a proactive
anti-virus service working around the clock, around
the globe, visit:
http://www.star.net.uk

________________________________________________________________________


--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





                
__________________________________________________________ 
Enjoy this Diwali with Y! India Click here 
http://in.promos.yahoo.com/fabmall/index.html

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



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