XSLT question. How to pair field tags with data when original XML has them in separate sections?

后端 未结 3 996
执笔经年
执笔经年 2021-01-03 13:32

I hope I don\'t lose anyone by mentioning Filemaker. I am trying to turn it\'s XML export into something usable by SSIS. FM\'s native XML export has field names and data i

3条回答
  •  执笔经年
    2021-01-03 13:56

    One elegant way to solve this problem is this:

    
    
      
      
    
      
      
        
          
        
      
    
      
        
          
        
      
    
      
        
        
          
        
      
    
    
    

    Which outputs on my system:

    
      
        Dr. Zim
        
    1234 Internet Way

    However, be warned that XML element names are subject to stricter rules than FileMaker column names. The above will crash and burn if your column names violate those rules.

    The notable features of the stylesheet are:

    • an for speedy lookup of nodes - this should become noticeable for larger inputs
    • exclude-result-prefixes to prevent declaration of the fmp namespace in the result
    • to create elements with a dynamic name
    • the use of the preceding-sibling XPath axis as a way of determining node position (because the position() function does not work in s

    Go ahead and ask if anything is unclear.

    Your other problem (number formatting) has an answer here: XSL: Formatting numbers, excluding trailing zeroes.

提交回复
热议问题