creating arrays in xslt

后端 未结 5 1708
日久生厌
日久生厌 2020-12-30 21:55

can array\'s be created and used in xslt? If so are there suitable examples online to study? If not is there a way to store values in a way that mimics an array?

5条回答
  •  清酒与你
    2020-12-30 22:21

    With XSLT 2.0 you can model any data type you want to.

    As example:

    
        
        
            A
            B
            C
        
        
            
        
    
    

    With any input, output:

    B
    

    In XSLT 1.0 there is not Temporaly Result Tree data type. There is a Result Tree Fragment data type that does not allow node-set operator. So, the only way to go is with extensions functions: in this case node-set() from EXSLT (MSXSL has a built-in node-set() extension, also).

    So, in XSLT 1.0 without extensions you can have only inline data model, or by params or by external document. As example:

    
        
        
            A
            B
            C
        
        
        
            
        
    
    

    Result, with any input:

    B
    

    Only if you want to, I can provide you a XSLT 1.0 plus extensions example (It's not standar...)

提交回复
热议问题