Solved

Using Saxon for XSLT transforms.

Posted on 2001-07-24
4
454 Views
Last Modified: 2013-11-18
I am having a problem using Saxon 6.4 when doing a transform.
How do you use the default namespace when doing a transform.  I have tried
many forms of XPATH, but i cannot get any data.  If i remove " xmlns="EN" from the envelope in the XML
everything works fine.  The problem is i cannot remove that information.

Hopefully someone can help with this.
I have included my XSL and XML


************** XML ******************
<?xml version="1.0" encoding="UTF-8"?>
<Envelope targetNamespace="EN" xmlns="EN" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:IM="IM" xmlns:FD="FD" xmlns:AM="AM" xmlns:EX="EX" version="en.xsd, v1.0, 21-May-2001">
<Header actor="www.ta.com" mustUnderstand="1">
<Manifest>              
<MessageType>              
<InquiryMsg>                                                                    
<FP>                                                                                
 <FPID>XXX</FPID>                                    
</FP>                                            
<FundEntity>  
<FundNbr>5894</FundNbr>                                          
</FundEntity>                                          
<InquiryMsgName>PosSum</InquiryMsgName>                                  
</InquiryMsg>                          
</MessageType>                    
<PTDIn>D</PTDIn>              
</Manifest>            
<Delivery>                                        
<Message>                                                            
 <MessageID>1</MessageID>                                
<TimeStamp>2000-09-22T18:39:09</TimeStamp>                      
</Message>                    
 <From>                                                          
<XMLSwitch>                                                              
<XMLSwitchID>XMLSID</XMLSwitchID>        
<XMLSwitchAddress>www.xyz.com</XMLSwitchAddress>                                    
</XMLSwitch>             <ReferenceID>ZZZZZZZZZZZZZZZ</ReferenceID>                    
</From>                        
 <To>                      <!-- (ToAddress )-->                            
 <ToAddress>www.ta.com</ToAddress>                    
 </To>            
<RouteHistory>                                                        
  <Originator>www.sp.com</Originator>                              
<RouteTo>                                                                            
 <ReceiveTime>2000-09-22T18:39:08</ReceiveTime>                                            
<ReleaseTime>2000-09-22T18:39:08</ReleaseTime>                                  
<RouteAddress>xmlswitch.prod.nscc.com</RouteAddress>
                                    </RouteTo>    
                   <RouteTo>        
<ReceiveTime>2000-09-22T18:39:10</ReceiveTime>                                          
 <ReleaseTime>2000-09-22T18:39:11</ReleaseTime>                                            
<RouteAddress></RouteAddress>                        
</RouteTo>                      
</RouteHistory>                
</Delivery>    
</Header>      
 <Body>
<SOAP:Fault xmlns="http://www.fidelity.com/fiis/TASchema" xmlns:SOAP="http://www.w3c.org/2000/10/XMLSchema">    
<SOAP:faultcode>300</SOAP:faultcode>    
<SOAP:faultstring>Invalid Request</SOAP:faultstring>    
<SOAP:detail>        
<errorcode>B001</errorcode>        
<message>soapmethodname Post Parameter is missing or invalid</message>    
</SOAP:detail></SOAP:Fault>
</Body>
</Envelope>


*************  END XML ****************

************* XSL ******************
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
             xmlns="EN"
          xmlns:SOAP="http://www.w3c.org/2000/10/XMLSchema"
          xmlns:java="saxon://com.fmr.fiis.fts.core.util.CFtsUtil"
          exclude-result-prefixes="java SOAP"
          version="1.0" >

<xsl:output method = "xml" indent = "yes" encoding="UTF-8" version="1.0"/>

<xsl:template match = "/">

<Envelope targetNamespace="EN" xmlns="EN" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:IM="IM" xmlns:FD="FD" xmlns:AM="AM" xmlns:EX="EX" version="en.xsd, v1.0, 21-May-2001">
            <Body>
                <Fault>
                    <faultcode>
                        <xsl:value-of select = "//Envelope//Body//SOAP:Fault" />
                    </faultcode>
                </Fault>
            </Body>
      </Envelope>
</xsl:template>
</xsl:stylesheet>

************ END XSL ***************
0
Comment
Question by:jefftk
  • 2
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
Yury_Delendik earned 300 total points
ID: 6316716
You can write:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
         xmlns="EN" xmlns:en="EN"
         xmlns:SOAP="http://www.w3c.org/2000/10/XMLSchema" xmlns:java="saxon://com.fmr.fiis.fts.core.util.CFtsUtil"
         exclude-result-prefixes="java SOAP"
         version="1.0" >

  <xsl:output method="xml" indent="yes" encoding="UTF-8" version="1.0" />
  <xsl:namespace-alias stylesheet-prefix="en" result-prefix="#default" />

<xsl:template match = "/">
<Envelope targetNamespace="EN" xmlns="EN" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:IM="IM" xmlns:FD="FD" xmlns:AM="AM" xmlns:EX="EX"
version="en.xsd, v1.0, 21-May-2001">
           <Body>
               <Fault>
                   <faultcode>
                       <xsl:value-of select="/en:Envelope/en:Body/SOAP:Fault/SOAP:faultcode" />
                   </faultcode>
               </Fault>
           </Body>
     </Envelope>
</xsl:template>
</xsl:stylesheet>

0
 

Author Comment

by:jefftk
ID: 6316844
I will give it a try!
Thanks!
0
 

Author Comment

by:jefftk
ID: 6317472
Thank you!
It works great!

Do you recommend any books or web sites for XPATH.
0
 
LVL 10

Expert Comment

by:Yury_Delendik
ID: 6319194
No. I use only http://www.w3.org/
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question