Including an XML file in an XML/XSL file

后端 未结 5 1502
时光说笑
时光说笑 2020-12-02 17:40

So currently I\'m doing some XML-> XSLT-> (HTML5/CSS3) work. Right now I have a menu.xml file, and I\'d like to include it in either the XSL file or the XML page. I\'ve done

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 18:13

    I was unable to get the code to work that people provided. However I did get a solution after trying several things. Name an xml file clGroup.xml (first two letters don't matter, but I am finding "Group" is required. This xml file will reference the xml you want to parse.

    clGroup xml:

     
    
    
      caGroup.xml
    
    

    Now name a file caGroup.xml and put in the following code:

    
    
        
            Calendar
            Calendar
            joeshowfakeaccount@gmail.com
        
        
            Week1
            
            
            Test01 Young Men Weekly
            02 Elders Home Teaching Message Birthday
            03 
            04 
            05  #Young Men Weekly
        
        
            Week2
            06 Fast Sunday
            07 FHE
            08 Young Men Tonight #Young Men Weekly going to Bishops storehouse 6PM to 7PM Young Men Weekly
            09 
            10 Scout Round Table at 7 PM 
            11 
            12 
        
      
    

    Now here is my XSLT file calendarGroup.xslt

    
    
    
    
    
    
      
        
          Table
          
        
        
          
              
              
    Sunday Monday Tuesday Wednesday Thursday Friday Saturday

    The benefit of setting up my code this way is I can easily create the xml from an excel file and not half to put in a declaration statement in the newly created file. You do need to have the format "xxGroup" for this to work together. You can add more groups to the clGroup file and they will parse in the XSLT allowing you to include more xml in the same XSLT parser. Make sure they are all in the same directory.

提交回复
热议问题