Solved

Using Saxon for XSLT transforms.

Posted on 2001-07-24
4
456 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
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…
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.

752 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