Detailed introduction to the instance code that uses xml, schema, and xslt at the same time

Source: Internet
Author: User
Tags xslt
I have never used schema before. I hope to add namespace and schema to my xml file this time, and then convert it into html using xslt. I didn't expect to spend a lot of time. Now I will record the results of my normal work and hope to help you. I have never used schema before. I hope to add namespace and schema to my xml file this time, and then use # wiki/1529.html "target =" _ blank "> xslt to convert it to html, I did not expect to spend a lot of time. Now I will record the results of my normal work and hope to help you.

Let's first look at my xml file. The menu to be used to define the webpage.

 
 
  
  
       
   
  
 

A simple xml file is used to automatically Generate a Schema file using the Generate schema function of xmlspy, and then make some minor modifications. The result is as follows:

 
 
  
     
   
      
    
        
       
      
      
      
      
   
  
  
     
   
      
    
        
       
      
   
  
 

Specifically, the xsd is specified using the Assign Schema function of xmlspy in xml. the root node menu_items in xml is:

 

Next, create an xslt file and only give the correct results:

 
 
  >
  
  
     
   
                 
   
   
 
  
      
    
  
          
     
  

What is annoying is that,

xpath-default-namespace="http://www.hz-sp.com/2005/XMLSchema-menu"

There is no effect on the match of xsl: template. it is estimated that the match is not xpath. However, this attribute does not work for select in for-each, which is strange. it is estimated that I have not understood how to use this attribute.

The above is a detailed description of the instance code that uses xml, schema, and xslt at the same time. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.