Solved

Using Saxon for XSLT transforms.

Posted on 2001-07-24
4
445 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa‚Ķ
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now