xsltProcessor setParameter : send an undefined number of params

前端 未结 3 1887
眼角桃花
眼角桃花 2021-01-23 04:24

I have an XSL file.

I have a PHP file with a XSLTProcessor named $bob.

I want to send to my xsl transformation some parameters.

So, I write

3条回答
  •  悲哀的现实
    2021-01-23 04:44

    Well decide on a separator character for your messages (i.e. a character that is ensured not to occur in a message), then pass in a string with the messages separated by that character e.g. if you choose | you pass in $bob->setParameter('', 'message', "Hi|It's Bob|How are you?");, then in your XSLT code to be used with libxslt use e.g.

    
    
    
    
    
      
        
           
             
           
        
      
    
    
    
      
    
    
    
    

    As far as I know that extension function str:tokenize is supported in libxslt which PHP 5 uses for XSLT so you should be able to use it. Or you need to write a template that does the tokenization in XSLT itself

提交回复
热议问题