Solved

Using Saxon for XSLT transforms.

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
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 create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

622 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