Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using Saxon for XSLT transforms.

Posted on 2001-07-24
4
Medium Priority
?
459 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 1200 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

RHCE - Red Hat OpenStack Prep Course

This course will provide in-depth training so that students who currently hold the EX200 & EX210 certifications can sit for the EX310 exam. Students will learn how to deploy & manage a full Red Hat environment with Ceph block storage, & integrate Ceph into other OpenStack service

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

722 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